Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor CLI commands #135

Open
srueg opened this issue Jul 3, 2020 · 3 comments
Open

Refactor CLI commands #135

srueg opened this issue Jul 3, 2020 · 3 comments
Labels
enhancement New feature or request RFC Request for Comments UX Improvements to the user experience

Comments

@srueg
Copy link
Contributor

srueg commented Jul 3, 2020

Context

The commodore clean command removes the entire inventory and all components. Changes which are not checked into git will be lost. On a regular catalog compile (if not --local mode), the clean command is run first.

The safeguard should interactively ask if changes should really be dropped in case of a dirty workspace. A --force flag could be implemented to drop changes without asking first (for example in a CI/CD or test context).

@srueg srueg added enhancement New feature or request good first issue Good for newcomers labels Jul 3, 2020
@akosma
Copy link
Contributor

akosma commented Jul 29, 2020

This is a huge usability issue. A tool should never, under any circumstances, delete the work created by a user without (at the very least) getting a warning first. This behaviour is not only misleading, it can be counterproductive to a strategy directed towards driving others to use this tool.

My suggestion:

  • The compile command never deletes anything, under any circumstances.
  • Instead, a set of flags (like --clean or --delete or --force) explicitly does this; a warning is given unless --force is used. Even better, a separate command (see below)
  • If the current state is incorrect for a compile command, this command should provide the user with the required contextual information and/or workarounds (for example, "use the --clean flag to start over") so that the user gets the work done.
  • Add a separate set of commodore commands, such as the aforementioned clean (not a flag to another command, but rather a separate command: commodore clean) and also commodore push so that certain behaviours are explicit and coherent with a simple(r) mental model.

Given the heavy use of git in this project, using common git idioms (such as commit being different than push being different to checkout -- . to clean all changes) would help a lot.

@srueg
Copy link
Contributor Author

srueg commented Aug 3, 2020

I like the idea of this. Also, there already is a catalog clean command. I'd propose the following command structure:
"Working dirs" means the following directories: inventory/*, dependencies/* and catalog.

  • commodore catalog compile <cluster-id>
    • Compiles the catalog (without push)
    • If any working dir has a "dirty" state, ask what to do
    • Optional -f,--force to skip asking and remove all local changes
    • Optional -l,--local to skip asking and keep local changes
  • commodore catalog push <cluster-id>
    • Compiles and pushes the catalog
    • Optional -i,--interactive flag to show changes and ask to push Y/n
    • If any working dir has a "dirty" state, ask what to do
    • Optional -f,--force to remove all local changes without asking
    • Not sure if we should implement the --local option here?
  • commodore catalog fetch <cluster-id>
    • Fetches all working dirs
    • Optional -f,--force to skip asking and remove all local changes
    • Optional -l,--local to skip asking and keep local changes
  • commodore catalog clean
    • Cleans all working dirs
  • commodore catalog list/ls
    • Lists all catalogs (clusters) of this Lieutenant cluster

@srueg srueg added RFC Request for Comments and removed good first issue Good for newcomers labels Aug 3, 2020
@simu
Copy link
Member

simu commented Sep 2, 2020

How to handle more selective fetching in combination with local mode also came up in discussions regarding #160

The result of this discussion is that the following commands might be helpful to make the operation of Commodore more modular

  • commodore inventory fetch CLUSTER_ID
    • Fetches only the inventory for the specified cluster
  • commodore component fetch COMPONENT_NAME
    • Fetches only the specified component, taking into account any relevant configuration in inventory/ (commodore.yml, component_versions), if it exists.

@simu simu changed the title Safeguard "clean" Command Refactor CLI commands Sep 14, 2020
This was referenced Sep 14, 2020
@srueg srueg added the UX Improvements to the user experience label Oct 13, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request RFC Request for Comments UX Improvements to the user experience
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants