mirror of
https://github.com/schollz/croc.git
synced 2025-10-11 13:21:00 +02:00
open folder if no arguments given
This commit is contained in:
parent
5ecbab6673
commit
dc6493374a
2 changed files with 13 additions and 1 deletions
1
go.mod
1
go.mod
|
@ -15,6 +15,7 @@ require (
|
||||||
github.com/schollz/progressbar/v2 v2.6.0
|
github.com/schollz/progressbar/v2 v2.6.0
|
||||||
github.com/schollz/spinner v0.0.0-20180925172146-6bbc5f7804f9
|
github.com/schollz/spinner v0.0.0-20180925172146-6bbc5f7804f9
|
||||||
github.com/schollz/utils v1.0.0
|
github.com/schollz/utils v1.0.0
|
||||||
|
github.com/skratchdot/open-golang v0.0.0-20160302144031-75fb7ed4208c
|
||||||
github.com/stretchr/testify v1.2.2
|
github.com/stretchr/testify v1.2.2
|
||||||
github.com/tscholl2/siec v0.0.0-20180721101609-21667da05937
|
github.com/tscholl2/siec v0.0.0-20180721101609-21667da05937
|
||||||
github.com/urfave/cli v1.20.0
|
github.com/urfave/cli v1.20.0
|
||||||
|
|
|
@ -14,6 +14,7 @@ import (
|
||||||
humanize "github.com/dustin/go-humanize"
|
humanize "github.com/dustin/go-humanize"
|
||||||
"github.com/schollz/croc/src/croc"
|
"github.com/schollz/croc/src/croc"
|
||||||
"github.com/schollz/croc/src/utils"
|
"github.com/schollz/croc/src/utils"
|
||||||
|
"github.com/skratchdot/open-golang/open"
|
||||||
"github.com/urfave/cli"
|
"github.com/urfave/cli"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -187,10 +188,20 @@ func receive(c *cli.Context) error {
|
||||||
if c.Args().First() != "" {
|
if c.Args().First() != "" {
|
||||||
codePhrase = c.Args().First()
|
codePhrase = c.Args().First()
|
||||||
}
|
}
|
||||||
|
openFolder := false
|
||||||
|
if len(os.Args) == 1 {
|
||||||
|
// open folder since they didn't give any arguments
|
||||||
|
openFolder = true
|
||||||
|
}
|
||||||
if codePhrase == "" {
|
if codePhrase == "" {
|
||||||
codePhrase = utils.GetInput("Enter receive code: ")
|
codePhrase = utils.GetInput("Enter receive code: ")
|
||||||
}
|
}
|
||||||
return cr.Receive(codePhrase)
|
err := cr.Receive(codePhrase)
|
||||||
|
if err == nil && openFolder {
|
||||||
|
cwd, _ := os.Getwd()
|
||||||
|
open.Run(cwd)
|
||||||
|
}
|
||||||
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
func relay(c *cli.Context) error {
|
func relay(c *cli.Context) error {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue