mirror of
https://github.com/schollz/croc.git
synced 2025-10-11 05:11:06 +02:00
add stdin
This commit is contained in:
parent
ebad469554
commit
f315a0bb79
3 changed files with 11 additions and 3 deletions
11
main.go
11
main.go
|
@ -103,12 +103,19 @@ func main() {
|
|||
}
|
||||
|
||||
func send(c *cli.Context) error {
|
||||
if c.Args().First() == "" {
|
||||
stat, _ := os.Stdin.Stat()
|
||||
var fname string
|
||||
if (stat.Mode() & os.ModeCharDevice) == 0 {
|
||||
fname = "stdin"
|
||||
} else {
|
||||
fname = c.Args().First()
|
||||
}
|
||||
if fname == "" {
|
||||
return errors.New("must specify file: croc send [filename]")
|
||||
}
|
||||
cr.UseCompression = c.BoolT("compress")
|
||||
cr.UseEncryption = c.BoolT("encrypt")
|
||||
return cr.Send(c.Args().First(), c.GlobalString("code"))
|
||||
return cr.Send(fname, c.GlobalString("code"))
|
||||
}
|
||||
|
||||
func receive(c *cli.Context) error {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue