Fixed lint issues and missing documentation
This commit is contained in:
1 parent
7fd321df97
commit
6e6dec68c0
34 files changed
+346
-156
No files matched your search
@@ -7,6 +7,7 @@ import (
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
// NewCommand returns the "config" command, which shows and edits the configuration.
|
||||
func NewCommand(opts *cli.Options) *cobra.Command {
|
||||
cmd := &cobra.Command{
|
||||
Use: "config",
|
||||
|
||||
@@ -7,6 +7,7 @@ import (
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
// NewCommand returns the "fetch" command, which fetches opportunities once or as a service.
|
||||
func NewCommand(opts *cli.Options) *cobra.Command {
|
||||
cmd := &cobra.Command{
|
||||
Use: "fetch",
|
||||
|
||||
@@ -7,6 +7,9 @@ import (
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
// SetupInitialLogging starts logging to the terminal, at the level set by
|
||||
// cmd's --quiet and --debug flags (--debug wins), before any configuration
|
||||
// is loaded.
|
||||
func SetupInitialLogging(cmd *cobra.Command) {
|
||||
// Start logging to terminal first - any commands that want to use file
|
||||
// logging should activate it themselves
|
||||
|
||||
@@ -9,13 +9,15 @@ import (
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
// Options holds the flags shared by every command. Bind registers them on the
|
||||
// root command and RunSetup acts on them.
|
||||
type Options struct {
|
||||
configFile string
|
||||
debug bool
|
||||
quiet bool
|
||||
}
|
||||
|
||||
// Binds common options through the root command
|
||||
// Bind registers the shared flags as persistent flags on the root command cmd.
|
||||
func (o *Options) Bind(cmd *cobra.Command) {
|
||||
pf := cmd.PersistentFlags()
|
||||
pf.StringVarP(&o.configFile, "config", "c", "", "configuration file")
|
||||
@@ -25,7 +27,11 @@ func (o *Options) Bind(cmd *cobra.Command) {
|
||||
)
|
||||
}
|
||||
|
||||
// Setup loads the config and ensure logging is switch to file if needed
|
||||
// RunSetup prepares a command to run and returns its configuration. When
|
||||
// loadConfig is true it loads the configuration (from the --config file if
|
||||
// given), with --debug and --quiet overriding its log level, and then, unless
|
||||
// terminalLog is true, switches logging to the configured log file (staying
|
||||
// on the terminal, with a warning, if none is configured).
|
||||
func (o *Options) RunSetup(
|
||||
cmd *cobra.Command, loadConfig bool, terminalLog bool,
|
||||
) (*config.JobSearchConfig, error) {
|
||||
|
||||
@@ -8,6 +8,7 @@ import (
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
// NewCommand returns the "version" command.
|
||||
func NewCommand() *cobra.Command {
|
||||
cmd := &cobra.Command{
|
||||
Use: "version",
|
||||
|
||||
Reference in new issue
Block a user