This PR introduces a complete rewrite of the tool. Most notably the following changes were made:
CLI
Moving CLI related code into the cmd
directory. This includes the command and prompts definitions
Logic
Moving logic into the internal
directory. All the logic resides in this folder and is split up by logical chunks:
config
: Reading, modifying, validating and writing the JSON config file
constants
: Constant values used across the tool
fixes
: Some prompt related fixes (see #8)
git
: Everything git command / config related
models
: Model definition, User
and Scope
utils
: Small utility function used across the tool
Breaking changes
The following breaking change was introduced: The ability to use gitsu <alias>
to immediatly set a user profile (see #10 and #5) is now available via the gitsu init <alias>
command.
New features
gitsu now supports commands like:
gitsu
Use the arrow keys to navigate: ↓ ↑ → ←
Select action
▶ Select user
Add new user
Delete user
Modify user
gitsu select / gitsu s
With this command the user can immediatly proceed to select an existing user profile. Same as using gitsu
and selecting Select user
gitsu add / gitsu a
With this command the user can immediatly proceed to add a new user profile. Same as using gitsu
and selecting Add new user
gitsu delete / gitsu d
With this command the user can immediatly proceed to delete an existing user profile. Same as using gitsu
and selecting Delete user
gitsu modify / gitsu m
With this command the user can immediatly proceed to modify an existing user profile. Same as using gitsu
and selecting Modify user
gitsu reset / gitsu r
The following 2 user profile(s) will be deleted
[foo] Bar <[email protected]>
[lazy] Dog <[email protected]>
Use the arrow keys to navigate: ↓ ↑ → ←
Delete above profiles?
▶ Yes
No
With this command the user can reset / delete ALL existing user profiles. This closes #4
Special alias 'default'
With the special alias default
the user can specify a default user profile which gets set when executing gitsu init
without supplying an alias (see Breaking changes).
New fields in User model
Two new fields were added to the User
model:
AddedAt
: Timestamp when the profile was added
ModifiedAt
: Timestamp when the profile was modified
Currently these fields aren't used, but will allow for future improvements like history for example.
Let me know what you think about this PR and if anything should be adjusted!