diff options
author | kitsunyan | 2018-04-29 14:11:44 +0000 |
---|---|---|
committer | kitsunyan | 2018-04-29 14:11:44 +0000 |
commit | 924a732b2ffb672ed56b39bb06239d0105323f4a (patch) | |
tree | 06e1c1f0d6ee5166df416bfa2892e174a1d4b273 | |
parent | 9525d77603309b81faa43b14137b0a48f7391850 (diff) |
Use "-n" as short version of "--build"
-rw-r--r-- | doc/pakku.8.txt | 2 | ||||
-rw-r--r-- | src/main.nim | 17 | ||||
-rw-r--r-- | src/pacman.nim | 2 |
3 files changed, 12 insertions, 9 deletions
diff --git a/doc/pakku.8.txt b/doc/pakku.8.txt index 63cf69c..d9a0e00 100644 --- a/doc/pakku.8.txt +++ b/doc/pakku.8.txt @@ -27,7 +27,7 @@ Query Options (apply to '-Q')[[QO]] Sync Options (apply to '-S')[[SO]] ---------------------------------- -*\--build*:: +*-n, \--build*:: Build packages from source. Building is supported for directly specified packages only, so it will not work for package groups or virtual packages. diff --git a/src/main.nim b/src/main.nim index d156834..fbf3364 100644 --- a/src/main.nim +++ b/src/main.nim @@ -159,12 +159,15 @@ proc handleUpgrade(args: seq[Argument], config: Config): int = commonOptions, transactionOptions, upgradeOptions) proc handleHelp(operation: OperationType) = - proc printHelp(command: string, text: string) = - if command.len > 14: - echo(' '.repeat(6), "--", command) + proc printHelp(pair: OptionPair, arg: Option[string], text: string) = + let shortPrefix = pair.short.map(s => " -" & s & ", ").get(' '.repeat(6)) + let longValue = arg.map(a => pair.long & " <" & a & ">").get(pair.long) + + if longValue.len > 14: + echo(shortPrefix, "--", longValue) echo(' '.repeat(23), text) else: - echo(' '.repeat(6), "--", command, ' '.repeat(15 - command.len), text) + echo(shortPrefix, "--", longValue, ' '.repeat(15 - longValue.len), text) let operationArgs = operations .filter(o => o.otype == operation) @@ -179,9 +182,9 @@ proc handleHelp(operation: OperationType) = if lines.len > 0: case operation: of OperationType.sync: - printHelp("build", tr"build targets from source") - printHelp("keyserver <name>", tr"use name as keyserver to receive keys from") - printHelp("noaur", tr"disable all AUR operations") + printHelp(%%%"build", none(string), tr"build targets from source") + printHelp(%%%"keyserver", some("name"), tr"use name as keyserver to receive keys from") + printHelp(%%%"noaur", none(string), tr"disable all AUR operations") else: discard diff --git a/src/pacman.nim b/src/pacman.nim index 2ad3560..f5df4e4 100644 --- a/src/pacman.nim +++ b/src/pacman.nim @@ -140,7 +140,7 @@ const o("u", "sysupgrade") + g(syncInstall), o("w", "downloadonly"), o("y", "refresh") + g(syncInstall, syncSearch, syncQuery), - $o("build") + g(syncInstall), + $o("n", "build") + g(syncInstall), $(^o("keyserver")) + g(syncInstall), $o("noaur") + g(syncInstall) ] |