This commit is contained in:
@@ -39,6 +39,22 @@ func ActionUpload(c *cli.Context) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func ActionDelete(c *cli.Context) error {
|
||||
clnt := client.Client{
|
||||
BaseURL: c.String("url"),
|
||||
}
|
||||
for _, arg := range c.Args().Slice() {
|
||||
ctx, cancel := context.WithTimeout(c.Context, 5*time.Second)
|
||||
defer cancel()
|
||||
if err := clnt.Delete(ctx, arg); err != nil {
|
||||
fmt.Printf("Error deleting file %s\n", arg)
|
||||
fmt.Printf("%s\n", err)
|
||||
}
|
||||
fmt.Printf("Deleted %s\n", arg)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func ActionLogin(c *cli.Context) error {
|
||||
username := c.Args().First()
|
||||
if username == "" {
|
||||
|
@@ -37,6 +37,12 @@ func main() {
|
||||
ArgsUsage: "FILE [FILE]...",
|
||||
Action: actions.ActionUpload,
|
||||
},
|
||||
{
|
||||
Name: "delete",
|
||||
Usage: "Delete file(s)",
|
||||
ArgsUsage: "FILE [FILE]...",
|
||||
Action: actions.ActionDelete,
|
||||
},
|
||||
{
|
||||
Name: "login",
|
||||
Usage: "Login to gpaste server",
|
||||
|
Reference in New Issue
Block a user