solidarity icon indicating copy to clipboard operation
solidarity copied to clipboard

Easily add a new rules with snapshot

Open GantMan opened this issue 7 years ago • 6 comments

CLI with no version

$ solidarity snapshot cli detox
Would you like to add the binary `detox` to your Solidarity file? (Y/n) True
Update complete

CLI with a version

$ solidarity snapshot cli node
Would you like to add the binary `node` to your Solidarity file? (Y/n) True
Would you like to enforce a version requirement? (Y/n) True
Your system currently has version 8.6.0
Semver requirement for `node` binary : ^8.6.0
Update complete

ENV var

$ solidarity snapshot env PATH
Would you like to add the environment requirement `PATH` to you Solidarity file? (Y/n) True
Update complete

File/Dir also.

$ solidarity snapshot file ./nachos
Would you like to add the file requirement `./nachos` to you Solidarity file? (Y/n) True
Update complete

GantMan avatar Oct 17 '17 18:10 GantMan

@GantMan, I'm going to pick this up if nobody has started on this yet. I will put a PR early once I have a working implementation.

mattathompson avatar Nov 19 '17 21:11 mattathompson

Sounds good. Should someone just say solidarity snapshot cli and then it asks them questions regarding the CLI rule? Or do you like the specifics I have above?

Thinking "what's the optimal user experience" and then coding to that standard.

GantMan avatar Nov 20 '17 05:11 GantMan

I'm okay with the original spec for the enhancement. Its one less step for the user.

That being said I think there is a potentially one missing step regarding a prompt for Making the new requirement or adding to an existing one.

So in the case of cli rule it would go as follows:

$ solidarity snapshot cli node
Would you like to add the binary `node` to your Solidarity file? (Y/n) True
Would you like to enforce a version requirement? (Y/n) True

Your system currently has version 8.6.0
Semver requirement for `node` binary : ^8.6.0

Would you like to add your new rule to an existing requirement or create a new one?(Y/n) True
What whould you like to name your new requirement? Node

Update complete

mattathompson avatar Nov 20 '17 23:11 mattathompson

If the user chooses to add to an existing requirement then we list the existing requirements.

mattathompson avatar Nov 21 '17 00:11 mattathompson

looks great

GantMan avatar Nov 21 '17 14:11 GantMan

The PR w/ this functionality has been merged into master. I'm going to start another PR for the documentation.

mattathompson avatar Dec 29 '17 20:12 mattathompson