Skip to content

Commit

Permalink
style(setup): Convert some flags to sub commands
Browse files Browse the repository at this point in the history
Since flags should not do very different operations.
  • Loading branch information
5ouma committed Feb 13, 2024
1 parent b6b6059 commit 3ed472d
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 16 deletions.
20 changes: 12 additions & 8 deletions .github/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,24 +63,28 @@ Run one line [setup](../setup), see the [usage](#-usage) for the detail.
> _Just config files_
>
> ```shell
> zsh <(curl -sL dotup.vercel.app) --set
> zsh <(curl -sL dotup.vercel.app) set
> ```
<br /><br />
## 📊 Usage
### `setup --help`
### `setup help`
```shell
Usage: setup
Usage: setup
⚙️ The most minimal and powerful dotfiles ever.
⚙️ The most minimal and powerful dotfiles ever.
Flags:
-h, --help Print help information
-y, --yes Start without confirmation
-s, --set Set files to home directory
▌ Commands:
help Print help information
set Set files to home directory
▌ Flags:
• -y, --yes Start without confirmation
```
<br /><br />
Expand Down
18 changes: 10 additions & 8 deletions setup
Original file line number Diff line number Diff line change
Expand Up @@ -128,10 +128,12 @@ helpMsg() {
> ⚙️ The most minimal and powerful dotfiles ever.
## Commands:
- help Print help information
- set Set files to home directory
## Flags:
- -h, --help Print help information
- -y, --yes Start without confirmation
- -s, --set Set files to home directory
- -y, --yes Start without confirmation
EOM
}

Expand Down Expand Up @@ -171,18 +173,18 @@ EOM
fi
else
case "$1" in
'-h' | '--help')
'help')
helpMsg
exit
;;
'set')
getDot && checkSym && mkSym
exit
;;
'-y' | '--yes')
goThrough=true
export NONINTERACTIVE=1
;;
'-s' | '--set')
getDot && checkSym && mkSym
exit
;;
*)
gum format <<EOM
> **$(gum style 1 'Error')**
Expand Down

0 comments on commit 3ed472d

Please sign in to comment.