vcstool icon indicating copy to clipboard operation
vcstool copied to clipboard

Add an `rm-all` option to `vcs`

Open bergercookie opened this issue 4 years ago • 6 comments

As discussed earlier in https://github.com/dirk-thomas/vcstool/issues/195 it would be useful to have an rm-all option whose purpose is to remove the already cloned repositories, as specified by the given YAML file. This is so that the user can potentially clone a new set of dependencies using a new YAML file and not have to manually clean the target directory.

rm-all has a similar interface to import in that it accepts both --input ... as well as input redirection. It also requires either the -f/--force option or the -n/--dry-run option to actually execute. This is the same behavior as tools such as git clean and its purpose is to avoid a user mistake.

Here are some example usages of the command:

Typical usage:

$ vcs rm-all -f src/  < repos.yaml
Paths to delete:

- src/follow_waypoints
- src/kobuki
$ vcs rm-all -n src/  < repos.yaml
Paths to delete:

- src/follow_waypoints
- src/kobuki

[Dry Run]

Not allowed:

$ vcs rm-all  src/  < repos.yaml
usage: vcs rm-all [-h] [--input FILE_OR_URL] (-n | -f) [path]
vcs rm-all: error: one of the arguments -n/--dry-run -f/--force is required

General thoughts

  • I don't see a straightforward way of doing linting locally and see what errors currently exist in the code to be committed. I think this is inherent to flake8 and its output format IMO which is hard to read and decipher.

    On top of that, there's no reliable tool to correct these errors that I know of. I've been using autopep8 but even after running it and re-formatting my code, it's still not guaranteed that it will pass the flake8 checks since there are edge cases in which auotpep8 doesn't format the code.

    Towards that end, I think it would make sense to switch to a linter like black. It also offers formatting functionalities and in my experience at least, it's rock solid. This way we would also not need a custom python script such as test_flake8.py, since checking the code would be as easy as black --check path/to/file_or_directory.

    Not terribly important, but improvements like this would make developing on the repo a more pleasant experience. What's your take?

  • it would be useful to require a minimum python version of at least 3.6. There are many nice features starting in that version, like pathlib.Path and f-strings, mypy code annotations which would really help.

bergercookie avatar May 26 '21 15:05 bergercookie

@dirk-thomas , friendly ping. :)

bergercookie avatar Jun 03 '21 20:06 bergercookie

Hi @dirk-thomas ,

Could you take a look at this PR? I think it would be useful to get this merged or at least get feedback on changes needed in order to get it merged

bergercookie avatar Oct 29 '21 10:10 bergercookie

@dirk-thomas , friendly ping

bergercookie avatar Jan 21 '22 16:01 bergercookie

I'd also like to get this feature, but it looks like there's no active development happening here anymore, could be worth considering PRing to https://github.com/MaxandreOgeret/vcstool2/

LukeAI avatar Apr 14 '23 18:04 LukeAI

Hi @LukeAI,

I don't currently plan putting more effort in this PR. Do feel free however to port this to the new vcstool2 repo. ;)

bergercookie avatar Apr 18 '23 13:04 bergercookie

Hi @LukeAI,

I don't currently plan putting more effort in this PR. Do feel free however to port this to the new vcstool2 repo. ;)

fair enough! thanks, sounds like a good weekend project.

LukeAI avatar Apr 18 '23 13:04 LukeAI