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

Component delete command #188

Merged
merged 7 commits into from
Sep 18, 2020

Conversation

chrisglass
Copy link
Contributor

This branch adds a component delete <slug> command to commodore.

It does the opposite of component add <slug>:

$ commodore component new my-awesome-component
Adding component my-awesome-component...
 > Installing component
Component my-awesome-component successfully added 🎉
$ commodore component delete my-awesome-component
Are you sure you want to delete component my-awesome-component? This action cannot be undone [y/N]: y
Component my-awesome-component successfully deleted 🎉

It also introduces a --force parameter in case the interactive confirmation is not desired (for scripts, for instance):

$ commodore component delete --force my-awesome-component
Component my-awesome-component successfully deleted 🎉

Checklist

  • Keep pull requests small so they can be easily reviewed.
  • Update the documentation.
  • Update tests.
  • Update the ./CHANGELOG.md.
  • Link this PR to related issues.

Copy link
Contributor

@srueg srueg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, thanks!
Only found small typos.

tests/test_component.py Show resolved Hide resolved
commodore/dependency_mgmt.py Show resolved Hide resolved
@srueg srueg requested a review from simu September 17, 2020 15:48
Commodore already had a 'component new' command, this commit introduces
a new 'delete' counterpart that will cleanly remove a component
(identified by a slug) from the current catalog.
os.system() returns a number that is a (binary) mix between the syscall
that terminated the program and its exit code. In case of successful
program exit, there is no difference, but in case of error exit, the
result needs to be binary shifted (or masked) to get the actual exit
code.

This branch switches to using the recommended way to call a shell
command in python3 instead (subprocess.call()).

See https://docs.python.org/3/library/os.html#os.system for more
context.
The name didn't reflect the focus of the file anymore.
The code is smart enough to do that for the user now, the warning is not
needed anymore.
Renaming the file did cause more fallout than expected.
@chrisglass chrisglass force-pushed the component-delete-command branch from 5b8be28 to d965518 Compare September 18, 2020 13:45
@chrisglass chrisglass merged commit d31d4e1 into projectsyn:master Sep 18, 2020
@chrisglass chrisglass deleted the component-delete-command branch September 18, 2020 13:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants