-
Notifications
You must be signed in to change notification settings - Fork 292
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
CLI flag to only run certain sections? #44
Comments
Problem is, sometimes people re-order certain commands to run other commands before. In more complicated setups, this means link commands, shell commands, then some link commands, are run in various orders, and things might fail if the shell commands before them were not run. A possible solution for you would be to export your shell commands to scripts in your repository that, before they run, confirm you want to run. |
I don't agree that your scenario would introduce any problems, as I don't think the default behavior should change at all. It would just be extra, optional, arguments. Currently, I'm doing what you suggested, creating external scripts that prompt for confirmation. This already requires settings extra arguments (stdin: true and stdout: true), so adding a confirm option would make the configuration file simpler and not force users to clutter there repos with extra scripts that simply confirm whether or not they want the command to run. |
So it's not actually CLI arguments you are looking for, just an option in YAML to prompt before running? |
For the confirm option yeah. I see how I should have made that more clear >D On Thursday, June 18, 2015, Toyam Cox notifications@github.com wrote:
|
I'll poke at the source code and see if I understand the structure enough to do that. |
Nice of you to do so! I'd recommend looking at the executor/commandrunner.py script, adding a check for item.get('confirm', False) is True (to follow the convention already in place), then ask for confirmation and just |
What's the use case for this? What kinds of commands might you want to only run sometimes? And when would you want to leave the decision up to the user instead of automating the decision making (e.g. rewriting "fetch and install app" to an idempotent operation like "if application is not installed, fetch application from internet and install it"). At least in my use, my config has been idempotent. I think it's a good idea to try to structure stuff like this, so that you can always safely run |
I agree that it should be idempotent, my use case is I have multiple On Sunday, June 21, 2015, Anish Athalye notifications@github.com wrote:
|
Hmm, so if this is primarily used while editing the install config, I wonder if this is enough of a necessity to justify adding this feature? |
It's one of those cases where it's potentially a simple addition, with no change to default behavior, that might benefit a lot of people with the same use case. On the other hand, absolutely not necessary. Hence why I figured I'd open up discussion before just implementing it (figured it would take more than 5 minutes like the OrderedDict stuff did ;p) |
"with no change to default behavior" -- that's a good point. What's the best API for this? I don't really like Maybe if we kind of combined the two and made a single general purpose flag so you could run something like |
Okay, I think if we do this, it'll be in Dotbot 2.0. So it has to fit nicely into that design. I'll add this issue to the "features under consideration" of #35. |
I was just looking into this too! I think it would be great to test out various steps in isolation. For example only testing that the linking works properly or that custom shell steps work as intended before going on. |
With I think |
In which sense complicated? I didn't take a look at the source tbh but the first think that came into my mind was that dotbot does load the whole yaml at once right? So you only get the directives that match the It can be avoided by just creating some kind of temporary install.conf.yaml file based on the params give to install for example. So install It just would make testing a little but easier on my site as I have split up my yaml into multiple files and |
Not in terms of implementation -- I think it's a confusing API design. |
ah got you. That was the first think that came into my mind. Maybe there are better/more approachable ways to achieve the same. |
Is this going to be merged sometime soon? I've got a plugin I wrote to install packages, and I don't want to have to recheck whether their installed every time I want to update the symlinks for my dotfiles. At the moment I'm just planning to setup an environment variable which if defined makes the plugin skip all of this, but that's a fragile and far from ideal solution. Have you thought about somehow exposing the argument parsing framework for the CLI to plugins? I'm not sure how one would go about it, but it would be very nice :). |
There's no PR for this issue yet, so it's not just a matter of merging, someone needs to write the code. I think I might implement the
This is not on the roadmap. I think most plugins should take arguments via |
I see, thnx for the update 👍. |
Feedback welcome in #214 |
Yep, it appears to be working: Some points though:
|
Would it make sense to add a flag to only run the clean, link, or shell sections of the config? Sometimes I dont want the shell commands to run so I just comment them out. This could be implemented using flags (dotbot -c/--clean -l/--link -s/--shell), or possibly as "sub-commands" (dotbot {clean,link,shell} or dotbot run {clean,link,shell}) and the default would still be to perform all three tasks.
I also thought it might be useful to add another optional argument to shell configurations to prompt the user if they want the shell command to run or not, something like "confirm: true". Not really sure that would be useful if I could just tell dotbot to only clean and link.
The text was updated successfully, but these errors were encountered: