mirror of
https://github.com/schollz/croc.git
synced 2025-10-11 13:21:00 +02:00
prompt user if accidently receiving
This commit is contained in:
parent
aefb15105a
commit
a56334fc60
1 changed files with 8 additions and 0 deletions
|
@ -95,6 +95,14 @@ func Run() {
|
|||
fmt.Fprintf(c.App.Writer, "send\nreceive\relay")
|
||||
}
|
||||
app.Action = func(c *cli.Context) error {
|
||||
// if trying to send but forgot send, let the user know
|
||||
if c.Args().First() != "" && utils.Exists(c.Args().First()) {
|
||||
_, fname := filepath.Split(c.Args().First())
|
||||
yn := utils.GetInput(fmt.Sprintf("Did you mean to send '%s'? (y/n)", fname))
|
||||
if strings.ToLower(yn) == "y" {
|
||||
return send(c)
|
||||
}
|
||||
}
|
||||
return receive(c)
|
||||
}
|
||||
app.Before = func(c *cli.Context) error {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue