Skip to content

Commit

Permalink
Show workspaces list without args
Browse files Browse the repository at this point in the history
  • Loading branch information
navrocky committed May 8, 2024
1 parent 3c72872 commit aa550f7
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
* Suggest workspace name in `up` command if it not provided. Name suggested if current directory matches workspace or
try to up the latest active workspace.
* Added shortcuts for all commands
* `dcw` without args shows a list of all workspaces

# 1.1.2 (2024.04.24)

Expand Down
10 changes: 8 additions & 2 deletions cli/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,13 @@ int main(int argc, char** argv)
auto processExecutor = make_shared<ProcessExecutor>();
auto composeExecutor = make_shared<ComposeExecutorImpl>(processExecutor);
auto workspaceService = make_shared<WorkspaceService>(workspacesRepo, stateRepo, composeExecutor);

if (argc == 1) {
// if no args provided then print workspaces list
workspaceService->list(false);
return 0;
}

Commands commands = {
make_shared<AddCommand>(workspaceService),
make_shared<RemoveCommand>(workspaceService),
Expand All @@ -41,13 +48,12 @@ int main(int argc, char** argv)
};

CLI::App app { format("Docker Compose Workspace manager (v{})", APP_VERSION) };
app.require_subcommand();

for (const auto& cmd : commands) {
cmd->reg(app);
}

CLI11_PARSE(app, argc, argv);

return 0;
} catch (const exception& e) {
cerr << tc::red << "Error: " << e.what() << tc::reset << endl;
Expand Down

0 comments on commit aa550f7

Please sign in to comment.