Documentation ¶
Index ¶
Constants ¶
View Source
const BASH_COMPLETION_FILENAME = "ltst-completion.sh"
View Source
const COMMAND_KEY = "command"
View Source
const CONFIG_DIR = "$HOME"
View Source
const CONFIG_FILENAME = ".ltst"
View Source
const CONFIG_FILE_TYPE = "yaml"
View Source
const CONFIG_FULL_PATH = CONFIG_DIR + "/" + CONFIG_FILENAME + "." + CONFIG_FILE_TYPE
View Source
const GEN_AUTOCOMPLETE_FLAG = "gen-autocomplete"
Flags
View Source
const LONG_DESC_KEY = "longDescription"
View Source
const NAME_KEY = "name"
View Source
const NUM_RESULTS_FLAG = "num"
View Source
const OPEN_FLAG = "open"
View Source
const QUERY_KEY = "query"
View Source
const SHORT_DESC_KEY = "shortDescription"
Optional config keys
View Source
const URL_KEY = "url"
Required config keys
Variables ¶
View Source
var REQUIRED_CONFIG = [...]string{URL_KEY, QUERY_KEY, NAME_KEY, COMMAND_KEY}
View Source
var RootCmd = &cobra.Command{ Use: "ltst", Short: "Get the latest news", Long: "Get the latest news from all of your favorite sites! Fetched in parallel!", Run: func(cmd *cobra.Command, args []string) { shouldGenerateAutocomplete, err := cmd.Flags().GetBool(GEN_AUTOCOMPLETE_FLAG) if err != nil { fmt.Fprintf(os.Stderr, "Error reading %s flag: %s\n", GEN_AUTOCOMPLETE_FLAG, err) return } if shouldGenerateAutocomplete { cmd.GenBashCompletionFile(BASH_COMPLETION_FILENAME) return } numResultsPerCommand, err := cmd.Flags().GetInt(NUM_RESULTS_FLAG) if err != nil { fmt.Fprintf(os.Stderr, "Error reading %s flag: %s\n", NUM_RESULTS_FLAG, err) return } parallelPrintLatestOfAllCommands(cmd, numResultsPerCommand) }, }
RootCmd is the base command that defines this cobra app. In this case, it is ltst.
Functions ¶
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.