blob: 58855df64cad433a43675a41f79253eabca9cf3c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
package commands
import (
"fmt"
"github.com/Fuwn/yae/internal/yae"
"github.com/urfave/cli/v2"
)
func Drop(sources *yae.Sources) func(c *cli.Context) error {
return func(c *cli.Context) error {
if c.Args().Len() == 0 {
return fmt.Errorf("invalid number of arguments")
}
if !sources.Exists(c.Args().Get(0)) {
return fmt.Errorf("source does not exist")
}
sources.Drop(c.Args().Get(0))
return sources.Save(c.String("sources"))
}
}
|