瀏覽代碼

We can list catalog contents

default_compile_flags
vector-of-bool 5 年之前
父節點
當前提交
787465c6d4
共有 1 個檔案被更改,包括 17 行新增0 行删除
  1. +17
    -0
      src/dds/dds.main.cpp

+ 17
- 0
src/dds/dds.main.cpp 查看文件

@@ -250,6 +250,23 @@ struct cli_catalog {
}
} add{*this};

struct {
cli_catalog& parent;
args::Command cmd{parent.cat_group, "list", "List the contents of the catalog"};

catalog_path_flag cat_path{cmd};
string_flag name{cmd, "name", "Only list packages with the given name", {"name", 'n'}};

int run() {
auto cat = cat_path.open();
auto pkgs = name ? cat.by_name(name.Get()) : cat.all();
for (const dds::package_id& pk : pkgs) {
std::cout << pk.to_string() << '\n';
}
return 0;
}
} list{*this};

int run() {
if (create.cmd) {
return create.run();

Loading…
取消
儲存