Skip to content

Commit 01581a1

Browse files
committed
remove short only options from put command for go install to work
1 parent 79c5092 commit 01581a1

File tree

4 files changed

+20
-13
lines changed

4 files changed

+20
-13
lines changed

README.md

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,12 @@ sudo mv ./gtrash /usr/local/bin/gtrash
7777
brew install umlx5h/tap/gtrash
7878
```
7979

80+
### Go install
81+
82+
```
83+
go install github.com/umlx5h/gtrash@latest
84+
```
85+
8086
### Build from source
8187

8288
```bash
@@ -306,13 +312,13 @@ While `rm` uses the [unlink](https://man7.org/linux/man-pages/man2/unlink.2.html
306312
```bash
307313
$ gtrash put -h
308314
Flags:
309-
-d, --dir ignored unless --rm-mode set
310-
-f, --force ignore nonexistent files and arguments
311-
-i, --interactive prompt before every removal
312-
-I prompt once before trashing
313-
-r, -R, --recursive ignored unless --rm-mode set
314-
--rm-mode enable rm-like mode (change behavior -r, -R, -d)
315-
-v, --verbose explain what is being done
315+
-d, --dir ignored unless --rm-mode set
316+
-f, --force ignore nonexistent files and arguments
317+
-i, --interactive prompt before every removal
318+
-I, --interactive-once prompt once before trashing
319+
-r, -R, --recursive ignored unless --rm-mode set
320+
--rm-mode enable rm-like mode (change behavior -r, -R, -d)
321+
-v, --verbose explain what is being done
316322
```
317323

318324
The `-r` option is not necessary for deleting folders since files are restorable even if mistakenly removed.

go.mod

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,5 +46,3 @@ require (
4646
golang.org/x/text v0.14.0 // indirect
4747
gopkg.in/yaml.v3 v3.0.1 // indirect
4848
)
49-
50-
replace github.com/spf13/pflag => github.com/cornfeedhobo/pflag v1.1.0

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,6 @@ github.com/charmbracelet/lipgloss v0.9.1 h1:PNyd3jvaJbg4jRHKWXnCj1akQm4rh8dbEzN1
1010
github.com/charmbracelet/lipgloss v0.9.1/go.mod h1:1mPmG4cxScwUQALAAnacHaigiiHB9Pmr+v1VEawJl6I=
1111
github.com/containerd/console v1.0.4-0.20230313162750-1ae8d489ac81 h1:q2hJAaP1k2wIvVRd/hEHD7lacgqrCPS+k8g1MndzfWY=
1212
github.com/containerd/console v1.0.4-0.20230313162750-1ae8d489ac81/go.mod h1:YynlIjWYF8myEu6sdkwKIvGQq+cOckRm6So2avqoYAk=
13-
github.com/cornfeedhobo/pflag v1.1.0 h1:hZ356pzRepv6EbQ3M5Yx0ZyvQnTj8rgGKm6PCTFy2kc=
14-
github.com/cornfeedhobo/pflag v1.1.0/go.mod h1:ROo/cqBpAh84jplPcXiI5HTjyLmtp04WaPKkHC18E6U=
1513
github.com/cpuguy83/go-md2man/v2 v2.0.3/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o=
1614
github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
1715
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM=
@@ -79,6 +77,8 @@ github.com/rs/xid v1.5.0/go.mod h1:trrq9SKmegXys3aeAKXMUTdJsYXVwGY3RLcfgqegfbg=
7977
github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
8078
github.com/spf13/cobra v1.8.0 h1:7aJaZx1B85qltLMc546zn58BxxfZdR/W22ej9CFoEf0=
8179
github.com/spf13/cobra v1.8.0/go.mod h1:WXLWApfZ71AjXPya3WOlMsY9yMs7YeiHhFVlvLyhcho=
80+
github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA=
81+
github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
8282
github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk=
8383
github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
8484
github.com/umlx5h/go-runewidth v0.0.0-20240106112317-9bbbb3702d5f h1:T8MNFeOIelXNJyNQ5WIMz2zUXYpUq71+3Z5dbXqWCd8=

internal/cmd/put.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,8 @@ func newPutCmd() *putCmd {
8787
}
8888
cmd.Flags().BoolVarP(&root.opts.force, "force", "f", false, "ignore nonexistent files and arguments")
8989
cmd.Flags().BoolVarP(&root.opts.prompt, "interactive", "i", false, "prompt before every removal")
90-
cmd.Flags().BoolVarS(&root.opts.promptOnce, "I", "I", false, "prompt once before trashing")
90+
// short only options are not available
91+
cmd.Flags().BoolVarP(&root.opts.promptOnce, "interactive-once", "I", false, "prompt once before trashing")
9192
cmd.Flags().BoolVarP(&root.opts.verbose, "verbose", "v", false, "explain what is being done")
9293

9394
// rm mode options if --rm-mode used
@@ -96,7 +97,9 @@ func newPutCmd() *putCmd {
9697
remove empty directories (--rm-mode)`)
9798
cmd.Flags().BoolVarP(&root.opts.recursive, "recursive", "r", false, `ignored unless --rm-mode set
9899
remove directories and their contents recursively (--rm-mode)`)
99-
cmd.Flags().BoolVarS(&root.opts.recursive, "R", "R", false, "same as -r")
100+
101+
// TODO: Since short only options are not available, have no choice but to assign a long name.
102+
cmd.Flags().BoolVarP(&root.opts.recursive, "Recursive", "R", false, "same as -r")
100103

101104
cmd.Flags().BoolVar(&root.opts.homeFallback, "home-fallback", env.HOME_TRASH_FALLBACK_COPY, `Enable fallback to home directory trash
102105
If the deletion of a file in an external file system fails, this option may help.`)

0 commit comments

Comments
 (0)