Convert option descriptions to Markdown

This commit is contained in:
Eelco Dolstra 2021-01-13 14:18:04 +01:00
parent 4e9cec79bf
commit 3da9a9241c
26 changed files with 111 additions and 111 deletions

View file

@ -14,14 +14,14 @@ MixEvalArgs::MixEvalArgs()
{ {
addFlag({ addFlag({
.longName = "arg", .longName = "arg",
.description = "argument to be passed to Nix functions", .description = "Pass the value *expr* as the argument *name* to Nix functions.",
.labels = {"name", "expr"}, .labels = {"name", "expr"},
.handler = {[&](std::string name, std::string expr) { autoArgs[name] = 'E' + expr; }} .handler = {[&](std::string name, std::string expr) { autoArgs[name] = 'E' + expr; }}
}); });
addFlag({ addFlag({
.longName = "argstr", .longName = "argstr",
.description = "string-valued argument to be passed to Nix functions", .description = "Pass the string *string* as the argument *name* to Nix functions.",
.labels = {"name", "string"}, .labels = {"name", "string"},
.handler = {[&](std::string name, std::string s) { autoArgs[name] = 'S' + s; }}, .handler = {[&](std::string name, std::string s) { autoArgs[name] = 'S' + s; }},
}); });
@ -29,14 +29,14 @@ MixEvalArgs::MixEvalArgs()
addFlag({ addFlag({
.longName = "include", .longName = "include",
.shortName = 'I', .shortName = 'I',
.description = "add a path to the list of locations used to look up `<...>` file names", .description = "Add *path* to the list of locations used to look up `<...>` file names.",
.labels = {"path"}, .labels = {"path"},
.handler = {[&](std::string s) { searchPath.push_back(s); }} .handler = {[&](std::string s) { searchPath.push_back(s); }}
}); });
addFlag({ addFlag({
.longName = "impure", .longName = "impure",
.description = "allow access to mutable paths and repositories", .description = "Allow access to mutable paths and repositories.",
.handler = {[&]() { .handler = {[&]() {
evalSettings.pureEval = false; evalSettings.pureEval = false;
}}, }},
@ -44,7 +44,7 @@ MixEvalArgs::MixEvalArgs()
addFlag({ addFlag({
.longName = "override-flake", .longName = "override-flake",
.description = "override a flake registry value", .description = "Override the flake registries, redirecting *original-ref* to *resolved-ref*.",
.labels = {"original-ref", "resolved-ref"}, .labels = {"original-ref", "resolved-ref"},
.handler = {[&](std::string _from, std::string _to) { .handler = {[&](std::string _from, std::string _to) {
auto from = parseFlakeRef(_from, absPath(".")); auto from = parseFlakeRef(_from, absPath("."));

View file

@ -10,25 +10,25 @@ MixCommonArgs::MixCommonArgs(const string & programName)
addFlag({ addFlag({
.longName = "verbose", .longName = "verbose",
.shortName = 'v', .shortName = 'v',
.description = "increase verbosity level", .description = "Increase the logging verbosity level.",
.handler = {[]() { verbosity = (Verbosity) (verbosity + 1); }}, .handler = {[]() { verbosity = (Verbosity) (verbosity + 1); }},
}); });
addFlag({ addFlag({
.longName = "quiet", .longName = "quiet",
.description = "decrease verbosity level", .description = "Decrease the logging verbosity level.",
.handler = {[]() { verbosity = verbosity > lvlError ? (Verbosity) (verbosity - 1) : lvlError; }}, .handler = {[]() { verbosity = verbosity > lvlError ? (Verbosity) (verbosity - 1) : lvlError; }},
}); });
addFlag({ addFlag({
.longName = "debug", .longName = "debug",
.description = "enable debug output", .description = "Set the logging verbosity level to 'debug'.",
.handler = {[]() { verbosity = lvlDebug; }}, .handler = {[]() { verbosity = lvlDebug; }},
}); });
addFlag({ addFlag({
.longName = "option", .longName = "option",
.description = "set a Nix configuration option (overriding `nix.conf`)", .description = "Set the Nix configuration setting *name* to *value* (overriding `nix.conf`).",
.labels = {"name", "value"}, .labels = {"name", "value"},
.handler = {[](std::string name, std::string value) { .handler = {[](std::string name, std::string value) {
try { try {
@ -51,8 +51,7 @@ MixCommonArgs::MixCommonArgs(const string & programName)
addFlag({ addFlag({
.longName = "log-format", .longName = "log-format",
.description = "format of log output; `raw`, `internal-json`, `bar` " .description = "Set the format of log output; one of `raw`, `internal-json`, `bar` or `bar-with-logs`.",
"or `bar-with-logs`",
.labels = {"format"}, .labels = {"format"},
.handler = {[](std::string format) { setLogFormat(format); }}, .handler = {[](std::string format) { setLogFormat(format); }},
}); });
@ -60,7 +59,7 @@ MixCommonArgs::MixCommonArgs(const string & programName)
addFlag({ addFlag({
.longName = "max-jobs", .longName = "max-jobs",
.shortName = 'j', .shortName = 'j',
.description = "maximum number of parallel builds", .description = "The maximum number of parallel builds.",
.labels = Strings{"jobs"}, .labels = Strings{"jobs"},
.handler = {[=](std::string s) { .handler = {[=](std::string s) {
settings.set("max-jobs", s); settings.set("max-jobs", s);

View file

@ -16,7 +16,7 @@ struct MixDryRun : virtual Args
MixDryRun() MixDryRun()
{ {
mkFlag(0, "dry-run", "show what this command would do without doing it", &dryRun); mkFlag(0, "dry-run", "Show what this command would do without doing it.", &dryRun);
} }
}; };
@ -26,7 +26,7 @@ struct MixJSON : virtual Args
MixJSON() MixJSON()
{ {
mkFlag(0, "json", "produce JSON output", &json); mkFlag(0, "json", "Produce output in JSON format, suitable for consumption by another program.", &json);
} }
}; };

View file

@ -186,27 +186,27 @@ LegacyArgs::LegacyArgs(const std::string & programName,
addFlag({ addFlag({
.longName = "no-build-output", .longName = "no-build-output",
.shortName = 'Q', .shortName = 'Q',
.description = "do not show build output", .description = "Do not show build output.",
.handler = {[&]() {setLogFormat(LogFormat::raw); }}, .handler = {[&]() {setLogFormat(LogFormat::raw); }},
}); });
addFlag({ addFlag({
.longName = "keep-failed", .longName = "keep-failed",
.shortName ='K', .shortName ='K',
.description = "keep temporary directories of failed builds", .description = "Keep temporary directories of failed builds.",
.handler = {&(bool&) settings.keepFailed, true}, .handler = {&(bool&) settings.keepFailed, true},
}); });
addFlag({ addFlag({
.longName = "keep-going", .longName = "keep-going",
.shortName ='k', .shortName ='k',
.description = "keep going after a build fails", .description = "Keep going after a build fails.",
.handler = {&(bool&) settings.keepGoing, true}, .handler = {&(bool&) settings.keepGoing, true},
}); });
addFlag({ addFlag({
.longName = "fallback", .longName = "fallback",
.description = "build from source if substitution fails", .description = "Build from source if substitution fails.",
.handler = {&(bool&) settings.tryFallback, true}, .handler = {&(bool&) settings.tryFallback, true},
}); });
@ -225,19 +225,19 @@ LegacyArgs::LegacyArgs(const std::string & programName,
}); });
}; };
intSettingAlias(0, "cores", "maximum number of CPU cores to use inside a build", "cores"); intSettingAlias(0, "cores", "Maximum number of CPU cores to use inside a build.", "cores");
intSettingAlias(0, "max-silent-time", "number of seconds of silence before a build is killed", "max-silent-time"); intSettingAlias(0, "max-silent-time", "Number of seconds of silence before a build is killed.", "max-silent-time");
intSettingAlias(0, "timeout", "number of seconds before a build is killed", "timeout"); intSettingAlias(0, "timeout", "Number of seconds before a build is killed.", "timeout");
mkFlag(0, "readonly-mode", "do not write to the Nix store", mkFlag(0, "readonly-mode", "Do not write to the Nix store.",
&settings.readOnlyMode); &settings.readOnlyMode);
mkFlag(0, "no-gc-warning", "disable warning about not using '--add-root'", mkFlag(0, "no-gc-warning", "Disable warnings about not using `--add-root`.",
&gcWarning, false); &gcWarning, false);
addFlag({ addFlag({
.longName = "store", .longName = "store",
.description = "URI of the Nix store to use", .description = "The URL of the Nix store to use.",
.labels = {"store-uri"}, .labels = {"store-uri"},
.handler = {&(std::string&) settings.storeUri}, .handler = {&(std::string&) settings.storeUri},
}); });

View file

@ -19,7 +19,7 @@ struct CmdAddToStore : MixDryRun, StoreCommand
addFlag({ addFlag({
.longName = "name", .longName = "name",
.shortName = 'n', .shortName = 'n',
.description = "name component of the store path", .description = "Override the name component of the store path. It defaults to the base name of *path*.",
.labels = {"name"}, .labels = {"name"},
.handler = {&namePart}, .handler = {&namePart},
}); });

View file

@ -19,7 +19,7 @@ struct CmdBuild : InstallablesCommand, MixDryRun, MixJSON, MixProfile
addFlag({ addFlag({
.longName = "out-link", .longName = "out-link",
.shortName = 'o', .shortName = 'o',
.description = "path of the symlink to the build result", .description = "Use *path* as prefix for the symlinks to the build results. It defaults to `result`.",
.labels = {"path"}, .labels = {"path"},
.handler = {&outLink}, .handler = {&outLink},
.completer = completePath .completer = completePath
@ -27,13 +27,13 @@ struct CmdBuild : InstallablesCommand, MixDryRun, MixJSON, MixProfile
addFlag({ addFlag({
.longName = "no-link", .longName = "no-link",
.description = "do not create a symlink to the build result", .description = "Do not create symlinks to the build results.",
.handler = {&outLink, Path("")}, .handler = {&outLink, Path("")},
}); });
addFlag({ addFlag({
.longName = "rebuild", .longName = "rebuild",
.description = "rebuild an already built package and compare the result to the existing store paths", .description = "Rebuild an already built package and compare the result to the existing store paths.",
.handler = {&buildMode, bmCheck}, .handler = {&buildMode, bmCheck},
}); });
} }

View file

@ -16,7 +16,7 @@ struct CmdBundle : InstallableCommand
{ {
addFlag({ addFlag({
.longName = "bundler", .longName = "bundler",
.description = "use custom bundler", .description = fmt("Use a custom bundler instead of the default (`%s`).", bundler),
.labels = {"flake-url"}, .labels = {"flake-url"},
.handler = {&bundler}, .handler = {&bundler},
.completer = {[&](size_t, std::string_view prefix) { .completer = {[&](size_t, std::string_view prefix) {
@ -27,7 +27,7 @@ struct CmdBundle : InstallableCommand
addFlag({ addFlag({
.longName = "out-link", .longName = "out-link",
.shortName = 'o', .shortName = 'o',
.description = "path of the symlink to the build result", .description = "Override the name of the symlink to the build result. It defaults to the base name of the app.",
.labels = {"path"}, .labels = {"path"},
.handler = {&outLink}, .handler = {&outLink},
.completer = completePath .completer = completePath

View file

@ -65,18 +65,18 @@ StorePathsCommand::StorePathsCommand(bool recursive)
if (recursive) if (recursive)
addFlag({ addFlag({
.longName = "no-recursive", .longName = "no-recursive",
.description = "apply operation to specified paths only", .description = "Apply operation to specified paths only.",
.handler = {&this->recursive, false}, .handler = {&this->recursive, false},
}); });
else else
addFlag({ addFlag({
.longName = "recursive", .longName = "recursive",
.shortName = 'r', .shortName = 'r',
.description = "apply operation to closure of the specified paths", .description = "Apply operation to closure of the specified paths.",
.handler = {&this->recursive, true}, .handler = {&this->recursive, true},
}); });
mkFlag(0, "all", "apply operation to the entire store", &all); mkFlag(0, "all", "Apply the operation to every store path.", &all);
} }
void StorePathsCommand::run(ref<Store> store) void StorePathsCommand::run(ref<Store> store)
@ -133,7 +133,7 @@ MixProfile::MixProfile()
{ {
addFlag({ addFlag({
.longName = "profile", .longName = "profile",
.description = "profile to update", .description = "The profile to update.",
.labels = {"path"}, .labels = {"path"},
.handler = {&profile}, .handler = {&profile},
.completer = completePath .completer = completePath
@ -190,14 +190,14 @@ MixEnvironment::MixEnvironment() : ignoreEnvironment(false)
addFlag({ addFlag({
.longName = "ignore-environment", .longName = "ignore-environment",
.shortName = 'i', .shortName = 'i',
.description = "clear the entire environment (except those specified with --keep)", .description = "Clear the entire environment (except those specified with `--keep`).",
.handler = {&ignoreEnvironment, true}, .handler = {&ignoreEnvironment, true},
}); });
addFlag({ addFlag({
.longName = "keep", .longName = "keep",
.shortName = 'k', .shortName = 'k',
.description = "keep specified environment variable", .description = "Keep the environment variable *name*.",
.labels = {"name"}, .labels = {"name"},
.handler = {[&](std::string s) { keep.insert(s); }}, .handler = {[&](std::string s) { keep.insert(s); }},
}); });
@ -205,7 +205,7 @@ MixEnvironment::MixEnvironment() : ignoreEnvironment(false)
addFlag({ addFlag({
.longName = "unset", .longName = "unset",
.shortName = 'u', .shortName = 'u',
.description = "unset specified environment variable", .description = "Unset the environment variable *name*.",
.labels = {"name"}, .labels = {"name"},
.handler = {[&](std::string s) { unset.insert(s); }}, .handler = {[&](std::string s) { unset.insert(s); }},
}); });

View file

@ -21,28 +21,28 @@ struct CmdCopy : StorePathsCommand
{ {
addFlag({ addFlag({
.longName = "from", .longName = "from",
.description = "URI of the source Nix store", .description = "URL of the source Nix store.",
.labels = {"store-uri"}, .labels = {"store-uri"},
.handler = {&srcUri}, .handler = {&srcUri},
}); });
addFlag({ addFlag({
.longName = "to", .longName = "to",
.description = "URI of the destination Nix store", .description = "URL of the destination Nix store.",
.labels = {"store-uri"}, .labels = {"store-uri"},
.handler = {&dstUri}, .handler = {&dstUri},
}); });
addFlag({ addFlag({
.longName = "no-check-sigs", .longName = "no-check-sigs",
.description = "do not require that paths are signed by trusted keys", .description = "Do not require that paths are signed by trusted keys.",
.handler = {&checkSigs, NoCheckSigs}, .handler = {&checkSigs, NoCheckSigs},
}); });
addFlag({ addFlag({
.longName = "substitute-on-destination", .longName = "substitute-on-destination",
.shortName = 's', .shortName = 's',
.description = "whether to try substitutes on the destination store (only supported by SSH)", .description = "Whether to try substitutes on the destination store (only supported by SSH stores).",
.handler = {&substitute, Substitute}, .handler = {&substitute, Substitute},
}); });

View file

@ -204,7 +204,7 @@ struct Common : InstallableCommand, MixProfile
{ {
addFlag({ addFlag({
.longName = "redirect", .longName = "redirect",
.description = "redirect a store path to a mutable location", .description = "Redirect a store path to a mutable location.",
.labels = {"installable", "outputs-dir"}, .labels = {"installable", "outputs-dir"},
.handler = {[&](std::string installable, std::string outputsDir) { .handler = {[&](std::string installable, std::string outputsDir) {
redirects.push_back({installable, outputsDir}); redirects.push_back({installable, outputsDir});
@ -334,7 +334,7 @@ struct CmdDevelop : Common, MixEnvironment
addFlag({ addFlag({
.longName = "command", .longName = "command",
.shortName = 'c', .shortName = 'c',
.description = "command and arguments to be executed instead of an interactive shell", .description = "Instead of starting an interactive shell, start the specified command and arguments.",
.labels = {"command", "args"}, .labels = {"command", "args"},
.handler = {[&](std::vector<std::string> ss) { .handler = {[&](std::vector<std::string> ss) {
if (ss.empty()) throw UsageError("--command requires at least one argument"); if (ss.empty()) throw UsageError("--command requires at least one argument");
@ -344,38 +344,38 @@ struct CmdDevelop : Common, MixEnvironment
addFlag({ addFlag({
.longName = "phase", .longName = "phase",
.description = "phase to run (e.g. `build` or `configure`)", .description = "The stdenv phase to run (e.g. `build` or `configure`).",
.labels = {"phase-name"}, .labels = {"phase-name"},
.handler = {&phase}, .handler = {&phase},
}); });
addFlag({ addFlag({
.longName = "configure", .longName = "configure",
.description = "run the configure phase", .description = "Run the `configure` phase.",
.handler = {&phase, {"configure"}}, .handler = {&phase, {"configure"}},
}); });
addFlag({ addFlag({
.longName = "build", .longName = "build",
.description = "run the build phase", .description = "Run the `build` phase.",
.handler = {&phase, {"build"}}, .handler = {&phase, {"build"}},
}); });
addFlag({ addFlag({
.longName = "check", .longName = "check",
.description = "run the check phase", .description = "Run the `check` phase.",
.handler = {&phase, {"check"}}, .handler = {&phase, {"check"}},
}); });
addFlag({ addFlag({
.longName = "install", .longName = "install",
.description = "run the install phase", .description = "Run the `install` phase.",
.handler = {&phase, {"install"}}, .handler = {&phase, {"install"}},
}); });
addFlag({ addFlag({
.longName = "installcheck", .longName = "installcheck",
.description = "run the installcheck phase", .description = "Run the `installcheck` phase.",
.handler = {&phase, {"installCheck"}}, .handler = {&phase, {"installCheck"}},
}); });
} }

View file

@ -18,18 +18,18 @@ struct CmdEval : MixJSON, InstallableCommand
CmdEval() CmdEval()
{ {
mkFlag(0, "raw", "print strings unquoted", &raw); mkFlag(0, "raw", "Print strings without quotes or escaping.", &raw);
addFlag({ addFlag({
.longName = "apply", .longName = "apply",
.description = "apply a function to each argument", .description = "Apply the function *expr* to each argument.",
.labels = {"expr"}, .labels = {"expr"},
.handler = {&apply}, .handler = {&apply},
}); });
addFlag({ addFlag({
.longName = "write-to", .longName = "write-to",
.description = "write a string or attrset of strings to 'path'", .description = "Write a string or attrset of strings to *path*.",
.labels = {"path"}, .labels = {"path"},
.handler = {&writeTo}, .handler = {&writeTo},
}); });

View file

@ -222,7 +222,7 @@ struct CmdFlakeCheck : FlakeCommand
{ {
addFlag({ addFlag({
.longName = "no-build", .longName = "no-build",
.description = "do not build checks", .description = "Do not build checks.",
.handler = {&build, false} .handler = {&build, false}
}); });
} }
@ -573,7 +573,7 @@ struct CmdFlakeInitCommon : virtual Args, EvalCommand
addFlag({ addFlag({
.longName = "template", .longName = "template",
.shortName = 't', .shortName = 't',
.description = "the template to use", .description = "The template to use.",
.labels = {"template"}, .labels = {"template"},
.handler = {&templateUrl}, .handler = {&templateUrl},
.completer = {[&](size_t, std::string_view prefix) { .completer = {[&](size_t, std::string_view prefix) {
@ -717,7 +717,7 @@ struct CmdFlakeClone : FlakeCommand
addFlag({ addFlag({
.longName = "dest", .longName = "dest",
.shortName = 'f', .shortName = 'f',
.description = "destination path", .description = "Clone the flake to path *dest*.",
.labels = {"path"}, .labels = {"path"},
.handler = {&destDir} .handler = {&destDir}
}); });
@ -807,7 +807,7 @@ struct CmdFlakeShow : FlakeCommand
{ {
addFlag({ addFlag({
.longName = "legacy", .longName = "legacy",
.description = "show the contents of the 'legacyPackages' output", .description = "Show the contents of the `legacyPackages` output.",
.handler = {&showLegacy, true} .handler = {&showLegacy, true}
}); });
} }

View file

@ -19,15 +19,15 @@ struct CmdHashBase : Command
CmdHashBase(FileIngestionMethod mode) : mode(mode) CmdHashBase(FileIngestionMethod mode) : mode(mode)
{ {
mkFlag(0, "sri", "print hash in SRI format", &base, SRI); mkFlag(0, "sri", "Print the hash in SRI format.", &base, SRI);
mkFlag(0, "base64", "print hash in base-64", &base, Base64); mkFlag(0, "base64", "Print the hash in base-64 format.", &base, Base64);
mkFlag(0, "base32", "print hash in base-32 (Nix-specific)", &base, Base32); mkFlag(0, "base32", "Print the hash in base-32 (Nix-specific) format.", &base, Base32);
mkFlag(0, "base16", "print hash in base-16", &base, Base16); mkFlag(0, "base16", "Print the hash in base-16 format.", &base, Base16);
addFlag(Flag::mkHashTypeFlag("type", &ht)); addFlag(Flag::mkHashTypeFlag("type", &ht));
#if 0 #if 0
mkFlag() mkFlag()
.longName("modulo") .longName("modulo")
.description("compute hash modulo specified string") .description("Compute the hash modulo specified the string.")
.labels({"modulus"}) .labels({"modulus"})
.dest(&modulus); .dest(&modulus);
#endif #endif
@ -40,15 +40,14 @@ struct CmdHashBase : Command
std::string description() override std::string description() override
{ {
const char* d;
switch (mode) { switch (mode) {
case FileIngestionMethod::Flat: case FileIngestionMethod::Flat:
d = "print cryptographic hash of a regular file"; return "print cryptographic hash of a regular file";
break;
case FileIngestionMethod::Recursive: case FileIngestionMethod::Recursive:
d = "print cryptographic hash of the NAR serialisation of a path"; return "print cryptographic hash of the NAR serialisation of a path";
default:
assert(false);
}; };
return d;
} }
void run() override void run() override

View file

@ -60,37 +60,37 @@ MixFlakeOptions::MixFlakeOptions()
{ {
addFlag({ addFlag({
.longName = "recreate-lock-file", .longName = "recreate-lock-file",
.description = "recreate lock file from scratch", .description = "Recreate the flake's lock file from scratch.",
.handler = {&lockFlags.recreateLockFile, true} .handler = {&lockFlags.recreateLockFile, true}
}); });
addFlag({ addFlag({
.longName = "no-update-lock-file", .longName = "no-update-lock-file",
.description = "do not allow any updates to the lock file", .description = "Do not allow any updates to the flake's lock file.",
.handler = {&lockFlags.updateLockFile, false} .handler = {&lockFlags.updateLockFile, false}
}); });
addFlag({ addFlag({
.longName = "no-write-lock-file", .longName = "no-write-lock-file",
.description = "do not write the newly generated lock file", .description = "Do not write the flake's newly generated lock file.",
.handler = {&lockFlags.writeLockFile, false} .handler = {&lockFlags.writeLockFile, false}
}); });
addFlag({ addFlag({
.longName = "no-registries", .longName = "no-registries",
.description = "don't use flake registries", .description = "Don't allow lookups in the flake registries.",
.handler = {&lockFlags.useRegistries, false} .handler = {&lockFlags.useRegistries, false}
}); });
addFlag({ addFlag({
.longName = "commit-lock-file", .longName = "commit-lock-file",
.description = "commit changes to the lock file", .description = "Commit changes to the flake's lock file.",
.handler = {&lockFlags.commitLockFile, true} .handler = {&lockFlags.commitLockFile, true}
}); });
addFlag({ addFlag({
.longName = "update-input", .longName = "update-input",
.description = "update a specific flake input", .description = "Update a specific flake input (ignoring its previous entry in the lock file).",
.labels = {"input-path"}, .labels = {"input-path"},
.handler = {[&](std::string s) { .handler = {[&](std::string s) {
lockFlags.inputUpdates.insert(flake::parseInputPath(s)); lockFlags.inputUpdates.insert(flake::parseInputPath(s));
@ -103,7 +103,7 @@ MixFlakeOptions::MixFlakeOptions()
addFlag({ addFlag({
.longName = "override-input", .longName = "override-input",
.description = "override a specific flake input (e.g. `dwarffs/nixpkgs`)", .description = "Override a specific flake input (e.g. `dwarffs/nixpkgs`).",
.labels = {"input-path", "flake-url"}, .labels = {"input-path", "flake-url"},
.handler = {[&](std::string inputPath, std::string flakeRef) { .handler = {[&](std::string inputPath, std::string flakeRef) {
lockFlags.inputOverrides.insert_or_assign( lockFlags.inputOverrides.insert_or_assign(
@ -114,7 +114,7 @@ MixFlakeOptions::MixFlakeOptions()
addFlag({ addFlag({
.longName = "inputs-from", .longName = "inputs-from",
.description = "use the inputs of the specified flake as registry entries", .description = "Use the inputs of the specified flake as registry entries.",
.labels = {"flake-url"}, .labels = {"flake-url"},
.handler = {[&](std::string flakeRef) { .handler = {[&](std::string flakeRef) {
auto evalState = getEvalState(); auto evalState = getEvalState();
@ -143,22 +143,22 @@ SourceExprCommand::SourceExprCommand()
addFlag({ addFlag({
.longName = "file", .longName = "file",
.shortName = 'f', .shortName = 'f',
.description = "evaluate *file* rather than the default", .description = "Interpret installables as attribute paths relative to the Nix expression stored in *file*.",
.labels = {"file"}, .labels = {"file"},
.handler = {&file}, .handler = {&file},
.completer = completePath .completer = completePath
}); });
addFlag({ addFlag({
.longName ="expr", .longName = "expr",
.description = "evaluate attributes from *expr*", .description = "Interpret installables as attribute paths relative to the Nix expression *expr*.",
.labels = {"expr"}, .labels = {"expr"},
.handler = {&expr} .handler = {&expr}
}); });
addFlag({ addFlag({
.longName ="derivation", .longName = "derivation",
.description = "operate on the store derivation rather than its outputs", .description = "Operate on the store derivation rather than its outputs.",
.handler = {&operateOn, OperateOn::Derivation}, .handler = {&operateOn, OperateOn::Derivation},
}); });
} }

View file

@ -17,9 +17,9 @@ struct MixLs : virtual Args, MixJSON
MixLs() MixLs()
{ {
mkFlag('R', "recursive", "list subdirectories recursively", &recursive); mkFlag('R', "recursive", "List subdirectories recursively.", &recursive);
mkFlag('l', "long", "show more file information", &verbose); mkFlag('l', "long", "Show detailed file information.", &verbose);
mkFlag('d', "directory", "show directories rather than their contents", &showDirectory); mkFlag('d', "directory", "Show directories rather than their contents.", &showDirectory);
} }
void listText(ref<FSAccessor> accessor) void listText(ref<FSAccessor> accessor)

View file

@ -69,15 +69,15 @@ struct NixArgs : virtual MultiCommand, virtual MixCommonArgs
addFlag({ addFlag({
.longName = "help", .longName = "help",
.description = "show usage information", .description = "Show usage information.",
.handler = {[&]() { if (!completions) showHelpAndExit(); }}, .handler = {[&]() { if (!completions) showHelpAndExit(); }},
}); });
addFlag({ addFlag({
.longName = "help-config", .longName = "help-config",
.description = "show configuration options", .description = "Show configuration settings.",
.handler = {[&]() { .handler = {[&]() {
std::cout << "The following configuration options are available:\n\n"; std::cout << "The following configuration settings are available:\n\n";
Table2 tbl; Table2 tbl;
std::map<std::string, Config::SettingInfo> settings; std::map<std::string, Config::SettingInfo> settings;
globalConfig.getSettings(settings); globalConfig.getSettings(settings);
@ -91,25 +91,25 @@ struct NixArgs : virtual MultiCommand, virtual MixCommonArgs
addFlag({ addFlag({
.longName = "print-build-logs", .longName = "print-build-logs",
.shortName = 'L', .shortName = 'L',
.description = "print full build logs on stderr", .description = "Print full build logs on standard error.",
.handler = {[&]() {setLogFormat(LogFormat::barWithLogs); }}, .handler = {[&]() {setLogFormat(LogFormat::barWithLogs); }},
}); });
addFlag({ addFlag({
.longName = "version", .longName = "version",
.description = "show version information", .description = "Show version information.",
.handler = {[&]() { if (!completions) printVersion(programName); }}, .handler = {[&]() { if (!completions) printVersion(programName); }},
}); });
addFlag({ addFlag({
.longName = "no-net", .longName = "no-net",
.description = "disable substituters and consider all previously downloaded files up-to-date", .description = "Disable substituters and consider all previously downloaded files up-to-date.",
.handler = {[&]() { useNet = false; }}, .handler = {[&]() { useNet = false; }},
}); });
addFlag({ addFlag({
.longName = "refresh", .longName = "refresh",
.description = "consider all previously downloaded files out-of-date", .description = "Consider all previously downloaded files out-of-date.",
.handler = {[&]() { refresh = true; }}, .handler = {[&]() { refresh = true; }},
}); });
} }

View file

@ -18,10 +18,10 @@ struct CmdPathInfo : StorePathsCommand, MixJSON
CmdPathInfo() CmdPathInfo()
{ {
mkFlag('s', "size", "print size of the NAR dump of each path", &showSize); mkFlag('s', "size", "Print the size of the NAR serialisation of each path.", &showSize);
mkFlag('S', "closure-size", "print sum size of the NAR dumps of the closure of each path", &showClosureSize); mkFlag('S', "closure-size", "Print the sum of the sizes of the NAR serialisations of the closure of each path.", &showClosureSize);
mkFlag('h', "human-readable", "with -s and -S, print sizes like 1K 234M 5.67G etc.", &humanReadable); mkFlag('h', "human-readable", "With `-s` and `-S`, print sizes in a human-friendly format such as `5.67G`.", &humanReadable);
mkFlag(0, "sigs", "show signatures", &showSigs); mkFlag(0, "sigs", "Show signatures.", &showSigs);
} }
std::string description() override std::string description() override

View file

@ -258,14 +258,14 @@ struct CmdStorePrefetchFile : StoreCommand, MixJSON
{ {
addFlag({ addFlag({
.longName = "name", .longName = "name",
.description = "store path name", .description = "Override the name component of the resulting store path. It defaults to the base name of *url*.",
.labels = {"name"}, .labels = {"name"},
.handler = {&name} .handler = {&name}
}); });
addFlag({ addFlag({
.longName = "expected-hash", .longName = "expected-hash",
.description = "expected hash of the file", .description = "The expected hash of the file.",
.labels = {"hash"}, .labels = {"hash"},
.handler = {[&](std::string s) { .handler = {[&](std::string s) {
expectedHash = Hash::parseAny(s, hashType); expectedHash = Hash::parseAny(s, hashType);
@ -276,7 +276,9 @@ struct CmdStorePrefetchFile : StoreCommand, MixJSON
addFlag({ addFlag({
.longName = "executable", .longName = "executable",
.description = "make the resulting file executable", .description =
"Make the resulting file executable. Note that this causes the "
"resulting hash to be a NAR hash rather than a flat file hash.",
.handler = {&executable, true}, .handler = {&executable, true},
}); });

View file

@ -72,7 +72,7 @@ struct CmdShell : InstallablesCommand, RunCommon, MixEnvironment
addFlag({ addFlag({
.longName = "command", .longName = "command",
.shortName = 'c', .shortName = 'c',
.description = "command and arguments to be executed; defaults to '$SHELL'", .description = "Command and arguments to be executed, defaulting to `$SHELL`",
.labels = {"command", "args"}, .labels = {"command", "args"},
.handler = {[&](std::vector<std::string> ss) { .handler = {[&](std::vector<std::string> ss) {
if (ss.empty()) throw UsageError("--command requires at least one argument"); if (ss.empty()) throw UsageError("--command requires at least one argument");

View file

@ -19,7 +19,7 @@ struct CmdShowDerivation : InstallablesCommand
addFlag({ addFlag({
.longName = "recursive", .longName = "recursive",
.shortName = 'r', .shortName = 'r',
.description = "include the dependencies of the specified derivations", .description = "Include the dependencies of the specified derivations.",
.handler = {&recursive, true} .handler = {&recursive, true}
}); });
} }

View file

@ -16,7 +16,7 @@ struct CmdCopySigs : StorePathsCommand
addFlag({ addFlag({
.longName = "substituter", .longName = "substituter",
.shortName = 's', .shortName = 's',
.description = "use signatures from specified store", .description = "Use signatures from specified store.",
.labels = {"store-uri"}, .labels = {"store-uri"},
.handler = {[&](std::string s) { substituterUris.push_back(s); }}, .handler = {[&](std::string s) { substituterUris.push_back(s); }},
}); });
@ -101,7 +101,7 @@ struct CmdSignPaths : StorePathsCommand
addFlag({ addFlag({
.longName = "key-file", .longName = "key-file",
.shortName = 'k', .shortName = 'k',
.description = "file containing the secret signing key", .description = "File containing the secret signing key.",
.labels = {"file"}, .labels = {"file"},
.handler = {&secretKeyFile}, .handler = {&secretKeyFile},
.completer = completePath .completer = completePath
@ -150,7 +150,7 @@ struct CmdKeyGenerateSecret : Command
{ {
addFlag({ addFlag({
.longName = "key-name", .longName = "key-name",
.description = "identifier of the key (e.g. `cache.example.org-1`)", .description = "Identifier of the key (e.g. `cache.example.org-1`).",
.labels = {"name"}, .labels = {"name"},
.handler = {&keyName}, .handler = {&keyName},
}); });

View file

@ -13,7 +13,7 @@ struct CmdStoreDelete : StorePathsCommand
{ {
addFlag({ addFlag({
.longName = "ignore-liveness", .longName = "ignore-liveness",
.description = "do not check whether the paths are reachable from a root", .description = "Do not check whether the paths are reachable from a root.",
.handler = {&options.ignoreLiveness, true} .handler = {&options.ignoreLiveness, true}
}); });
} }

View file

@ -13,7 +13,7 @@ struct CmdStoreGC : StoreCommand, MixDryRun
{ {
addFlag({ addFlag({
.longName = "max", .longName = "max",
.description = "stop after freeing `n` bytes of disk space", .description = "Stop after freeing *n* bytes of disk space.",
.labels = {"n"}, .labels = {"n"},
.handler = {&options.maxFreed} .handler = {&options.maxFreed}
}); });

View file

@ -19,14 +19,14 @@ struct CmdUpgradeNix : MixDryRun, StoreCommand
addFlag({ addFlag({
.longName = "profile", .longName = "profile",
.shortName = 'p', .shortName = 'p',
.description = "the Nix profile to upgrade", .description = "The path to the Nix profile to upgrade.",
.labels = {"profile-dir"}, .labels = {"profile-dir"},
.handler = {&profileDir} .handler = {&profileDir}
}); });
addFlag({ addFlag({
.longName = "nix-store-paths-url", .longName = "nix-store-paths-url",
.description = "URL of the file that contains the store paths of the latest Nix release", .description = "The URL of the file that contains the store paths of the latest Nix release.",
.labels = {"url"}, .labels = {"url"},
.handler = {&storePathsUrl} .handler = {&storePathsUrl}
}); });

View file

@ -18,13 +18,13 @@ struct CmdVerify : StorePathsCommand
CmdVerify() CmdVerify()
{ {
mkFlag(0, "no-contents", "do not verify the contents of each store path", &noContents); mkFlag(0, "no-contents", "Do not verify the contents of each store path.", &noContents);
mkFlag(0, "no-trust", "do not verify whether each store path is trusted", &noTrust); mkFlag(0, "no-trust", "Do not verify whether each store path is trusted.", &noTrust);
addFlag({ addFlag({
.longName = "substituter", .longName = "substituter",
.shortName = 's', .shortName = 's',
.description = "use signatures from specified store", .description = "Use signatures from the specified store.",
.labels = {"store-uri"}, .labels = {"store-uri"},
.handler = {[&](std::string s) { substituterUris.push_back(s); }} .handler = {[&](std::string s) { substituterUris.push_back(s); }}
}); });
@ -32,7 +32,7 @@ struct CmdVerify : StorePathsCommand
addFlag({ addFlag({
.longName = "sigs-needed", .longName = "sigs-needed",
.shortName = 'n', .shortName = 'n',
.description = "require that each path has at least N valid signatures", .description = "Require that each path has at least *n* valid signatures.",
.labels = {"n"}, .labels = {"n"},
.handler = {&sigsNeeded} .handler = {&sigsNeeded}
}); });

View file

@ -40,7 +40,7 @@ struct CmdWhyDepends : SourceExprCommand
addFlag({ addFlag({
.longName = "all", .longName = "all",
.shortName = 'a', .shortName = 'a',
.description = "show all edges in the dependency graph leading from 'package' to 'dependency', rather than just a shortest path", .description = "Show all edges in the dependency graph leading from *package* to *dependency*, rather than just a shortest path.",
.handler = {&all, true}, .handler = {&all, true},
}); });
} }