aboutsummaryrefslogtreecommitdiff
path: root/src/nix/ls.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/nix/ls.cc')
-rw-r--r--src/nix/ls.cc13
1 files changed, 6 insertions, 7 deletions
diff --git a/src/nix/ls.cc b/src/nix/ls.cc
index 1f5ed6913..df67240f9 100644
--- a/src/nix/ls.cc
+++ b/src/nix/ls.cc
@@ -75,6 +75,8 @@ struct MixLs : virtual Args, MixJSON
if (json) {
JSONPlaceholder jsonRoot(std::cout);
+ if (showDirectory)
+ throw UsageError("'--directory' is useless with '--json'");
listNar(jsonRoot, accessor, path, recursive);
} else
listText(accessor);
@@ -127,14 +129,11 @@ struct CmdLsNar : Command, MixLs
expectArg("path", &path);
}
- Examples examples() override
+ std::string doc() override
{
- return {
- Example{
- "To list a specific file in a NAR:",
- "nix nar ls -l hello.nar /bin/hello"
- },
- };
+ return
+ #include "nar-ls.md"
+ ;
}
std::string description() override