diff options
Diffstat (limited to 'src/nix/ls.cc')
-rw-r--r-- | src/nix/ls.cc | 28 |
1 files changed, 12 insertions, 16 deletions
diff --git a/src/nix/ls.cc b/src/nix/ls.cc index 1f5ed6913..d48287f27 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); @@ -92,19 +94,16 @@ struct CmdLsStore : StoreCommand, MixLs }); } - Examples examples() override + std::string description() override { - return { - Example{ - "To list the contents of a store path in a binary cache:", - "nix store ls --store https://cache.nixos.org/ -lR /nix/store/0i2jd68mp5g6h2sa5k9c85rb80sn8hi9-hello-2.10" - }, - }; + return "show information about a path in the Nix store"; } - std::string description() override + std::string doc() override { - return "show information about a path in the Nix store"; + return + #include "store-ls.md" + ; } void run(ref<Store> store) override @@ -127,14 +126,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 |