Skip to content

Commit 8b4e9e8

Browse files
committed
chore: adjust init command for --template option & remove -v,-h option
1 parent 9c0ca24 commit 8b4e9e8

File tree

2 files changed

+11
-14
lines changed

2 files changed

+11
-14
lines changed

README.md

+6-5
Original file line numberDiff line numberDiff line change
@@ -21,18 +21,17 @@ gh extension install yuler/gh-todo
2121

2222
## How it works
2323

24-
First, you need run `gh todo init`. It will create `todo` repo based on [yuler/template-todo](https://github.com/yuler/template-todo) in your GitHub account.
24+
First, you need run `gh todo init`. It will create `todo` repo in your GitHub account.
2525

2626
**Note:**
2727

2828
- You can override the default repo name `todo` with the environment variable `GH_TODO_REPO`. Like this:
2929

3030
```bash
31-
export GH_TODO_REPO=repo-todo
32-
gh todo init
31+
GH_TODO_REPO=repo-todo gh todo init
3332
```
3433

35-
- And you can use `gh todo init --template yourname/template-todo` to use your own template.
34+
- And you can use `gh todo init --template yuler/template-todo` based on a template repository.
3635

3736
Then you can use `gh todo add` to add new task. It will create an issue with today(yyyy-MM-dd) as the title in `todo` repo.
3837

@@ -44,7 +43,7 @@ The `gh todo` or `gh todo list` where show todo list.
4443
# help
4544
gh todo --help
4645
# create `todo` repo
47-
gh todo init
46+
gh todo init --template=yuler/template-todo
4847
# open `issues` in browser
4948
gh todo home
5049
# add todo item
@@ -59,11 +58,13 @@ gh todo list
5958

6059
## Related
6160

61+
- [yuler/template-todo]
6262
- [todo.txt-cli]
6363
- [taskbook]
6464

6565
<!-- Links -->
6666

6767
[github cli]: https://github.com/cli/cli
68+
[yuler/template-todo]: https://github.com/yuler/template-todo
6869
[todo.txt-cli]: https://github.com/todotxt/todo.txt-cli
6970
[taskbook]: https://github.com/klaussinani/taskbook

gh-todo

+5-9
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
set -eo pipefail
33
IFS=$'\n\t'
44

5-
help() {
5+
usage() {
66
cat <<-EOF
77
Usage: gh todo
88
@@ -24,7 +24,6 @@ EOF
2424
version="0.2.2"
2525
today=$(date +"%Y-%m-%d")
2626
repo="$(gh config get -h github.com user)/todo"
27-
template_repo="yuler/template-todo"
2827

2928
if [ -n "$GH_TODO_REPO" ]; then
3029
repo="$GH_TODO_REPO"
@@ -35,10 +34,7 @@ get_issue_id() {
3534
}
3635

3736
init() {
38-
if [[ $1 == "--template" ]]; then
39-
template_repo=$2
40-
fi
41-
exec gh repo create --confirm --private --template $template_repo todo
37+
exec gh repo create --confirm --private $@ $repo
4238
}
4339

4440
home() {
@@ -91,12 +87,12 @@ fi
9187

9288
while [ $# -gt 0 ]; do
9389
case "$1" in
94-
-v | --version)
90+
--version)
9591
echo $version
9692
exit 0
9793
;;
98-
-h | --help)
99-
help
94+
--help)
95+
usage
10096
exit 0
10197
;;
10298
init)

0 commit comments

Comments
 (0)