aboutsummaryrefslogtreecommitdiff
path: root/yae.go
diff options
context:
space:
mode:
authorFuwn <[email protected]>2024-10-13 01:14:49 -0700
committerFuwn <[email protected]>2024-10-13 01:14:49 -0700
commit4353451af2a6edeeca75f5a87186d40d5e81159a (patch)
treed3f8915a08a88f417056c2e005afe508e0484e1e /yae.go
parent0aeae8d523ecb762e296b938cff3e012551e27b7 (diff)
downloadyae-4353451af2a6edeeca75f5a87186d40d5e81159a.tar.xz
yae-4353451af2a6edeeca75f5a87186d40d5e81159a.zip
refactor(commands): move flags to commands package
Diffstat (limited to 'yae.go')
-rw-r--r--yae.go63
1 files changed, 4 insertions, 59 deletions
diff --git a/yae.go b/yae.go
index 60be017..f5880e2 100644
--- a/yae.go
+++ b/yae.go
@@ -75,46 +75,8 @@ func main() {
Args: true,
ArgsUsage: "<name> <url>",
Usage: "Add a source",
- Flags: []cli.Flag{
- &cli.BoolFlag{
- Name: "unpack",
- Usage: "Unpack the source into the Nix Store",
- Value: true,
- },
- &cli.StringFlag{
- Name: "type",
- Usage: "Source type",
- Required: true,
- Action: func(c *cli.Context, value string) error {
- if value != "binary" && value != "git" {
- return fmt.Errorf("invalid source type: must be 'binary' or 'git'")
- }
-
- return nil
- },
- },
- &cli.StringFlag{
- Name: "version",
- Usage: "Source version used in identifying latest git source",
- },
- &cli.StringFlag{
- Name: "tag-predicate",
- Usage: "Git tag predicate used in identifying latest git source",
- },
- &cli.StringFlag{
- Name: "trim-tag-prefix",
- Usage: "A prefix to trim from remote git tags",
- },
- &cli.BoolFlag{
- Name: "pin",
- Usage: "Prevent the source from being updated",
- },
- &cli.BoolFlag{
- Name: "force",
- Usage: "Always force update the source, regardless of unchanged remote tag",
- },
- },
- Action: commands.Add(&sources),
+ Flags: commands.AddFlags(),
+ Action: commands.Add(&sources),
},
{
Name: "drop",
@@ -127,25 +89,8 @@ func main() {
Args: true,
Usage: "Update one or all sources",
ArgsUsage: "[name]",
- Flags: []cli.Flag{
- &cli.BoolFlag{
- Name: "output-updated-list",
- Usage: "Output a newline-seperated list of updated sources, regardless of silent mode",
- },
- &cli.BoolFlag{
- Name: "output-formatted-updated-list",
- Usage: "Output a comma and/or ampersand list of updated sources, regardless of silent mode",
- },
- &cli.BoolFlag{
- Name: "force-hashed",
- Usage: "Force updates for non-pinned sources that have an unchanged version (recalculate hash)",
- },
- &cli.BoolFlag{
- Name: "force-pinned",
- Usage: "Force updates for all sources, including pinned sources (can be used with --force-hashed)",
- },
- },
- Action: commands.Update(&sources),
+ Flags: commands.UpdateFlags(),
+ Action: commands.Update(&sources),
},
},
}).Run(os.Args); err != nil {