iScsc / iscsc.fr

The iScsc website, build with passion by wannabe devs 🔥
GNU General Public License v3.0
4 stars 12 forks source link

improve the CLI of `gpg-share` with user, help and check flags #37

Closed amtoine closed 1 year ago

amtoine commented 1 year ago

as introduced in #29, a new script has been added to the source to easily share the environment secrets with other developers using pgp keys and archives.

the current script

the script is used as follows:

bash> ./scripts/gpg-share.sh <file-to-share> <user1> <user2> ...

or, when multi-words users have to be used or to save the list of people in a file

bash> USER_FILE="users.txt" ./scripts/gpg-share.sh <file-to-share>

with the following users

# users.txt
first user
another-one
last user

this is arguably not the best experience...

idea of feature

during the review of #29, an idea has been introduced: using flags

this will lead to the following usage:

# users.txt
additional user
bash> ./scripts/gpg-share.sh -u "first user" -u "user" -u "last one" -U users.txt

or

bash> ./scripts/gpg-share.sh \
    -u "first user" \
    -u "user" \
    -u "last one" \
    -U users.txt

much better isn't it? :yum:

we could also add --help (-h) to see the help of the script and why not --check-keyring (-k) to check to keyring of the user calling the script and make sure everything is ok :ok_hand:

ctmbl commented 1 year ago

I like every feature you proposed! Maybe you could also address the problem of the script can't being run from ./scripts? even if the current check is fine :+1:

Just a slight proposal maybe:

- bash> ./scripts/gpg-share.sh -u "first user" -u "user" -u "last one" -U users.txt
+ bash> ./scripts/gpg-share.sh -u "first user" "user" "last one" -U users.txt

?

amtoine commented 1 year ago

I like every feature you proposed!

coool :yum:

Maybe you could also address the problem of the script can't being run from ./scripts? even if the current check is fine +1

i might have a look into this, but will not be the primary focus of the PR :+1:

Just a slight proposal maybe:

- bash> ./scripts/gpg-share.sh -u "first user" -u "user" -u "last one" -U users.txt
+ bash> ./scripts/gpg-share.sh -u "first user" "user" "last one" -U users.txt

?

yup what about allowing both? i'm just worried about "first user" "user" "last one" being treated by bash as "first user user last one" or "first" "user" "user" "last" "one" :thinking:

ctmbl commented 1 year ago

i might have a look into this, but will not be the primary focus of the PR +1

ofc :+1:

what about allowing both?

yeah absolutely!

i'm just worried about "first user" "user" "last one" being treated by bash as "first user user last one" or "first" "user" "user" "last" "one" thinking

actually we'll see but at worst we'll forbid multi words username in command line parameters :+1:

amtoine commented 1 year ago

actually we'll see but at worst we'll forbid multi words username in command line parameters +1

perfect :ok_hand: