// Copyright (C) 2021 nytpu // SPDX-License-Identifier: AGPL-3.0-or-later // For more license details, see LICENSE or . package main import flag "github.com/spf13/pflag" // globalFs contains the flags that are used in every command. var ( globalFs = flag.NewFlagSet("global", flag.ContinueOnError) dataFlag = globalFs.StringP("data", "d", "", "The data directory where comitium will store its files") ) // command holds fields used for printing information about a command. type command struct { Name string Usage string } // info about all the accepted commands var commandInfo = []command{ {"refresh", "Check for new updates to subscriptions"}, {"list", "List all subscriptions"}, {"add", "Add a new subscription"}, {"remove", "Remove a subscription"}, {"help", "Print usage information"}, {"version", "Print version information"}, } var commands = map[string]*flag.FlagSet{ "refresh": flag.NewFlagSet("refresh", flag.ExitOnError), "list": flag.NewFlagSet("list", flag.ExitOnError), "add": flag.NewFlagSet("add", flag.ExitOnError), "remove": flag.NewFlagSet("remove", flag.ExitOnError), } // set up various flags for each individual command var ( // add addTypeFlag = commands["add"].BoolP( "watch", "w", // long and shorthand flag false, // default `Watch a page instead of adding it as a feed.`, ) )