cmd

package
v0.0.6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 17, 2023 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var GenerateCommand = &cli.Command{
	Name:        "generate",
	Description: "Generates new readme",
	Flags: []cli.Flag{
		&cli.BoolFlag{
			Name:        "hide-unsolved",
			Value:       false,
			Destination: &config.HideUnsolvedProblems,
			Usage:       "Do not include unsolved problems in generated README",
		},
	},
	Action: func(ctx *cli.Context) error {
		gen, err := readme.NewGenerator(config)
		if err != nil {
			return fmt.Errorf("failed to create generator: %w", err)
		}
		if err := gen.GenerateReadme(context.Background()); err != nil {
			return err
		}

		log.Info("readme successfully generated")

		return nil
	},
}
View Source
var InitCommand = &cli.Command{
	Name:        "init",
	Description: "Initializes project",
	Action: func(ctx *cli.Context) error {
		filename := ctx.String("config")
		_, err := os.Stat(filename)
		if os.IsNotExist(err) {
			logger.WithField("file", filename).Info(boldStyle.Render("creating config file"))
			return createConfigFile()
		}

		if err == nil {
			logger.Info(boldStyle.Render("configuration already initialized"))
			return nil
		}

		return fmt.Errorf("failed to check config file: %w", err)
	},
}
View Source
var ProblemAddCommand = &cli.Command{
	Name:  "add",
	Usage: "add new problem to solved list",
	Action: func(ctx *cli.Context) error {

		log.Info(boldStyle.Render("adding new problem"))
		return nil
	},
}
View Source
var ProblemCommand = &cli.Command{
	Name:  "problem",
	Usage: "manage problems",
	Subcommands: cli.Commands{
		ProblemAddCommand,
	},
}
View Source
var VersionCommand = &cli.Command{
	Name:  "version",
	Usage: "Print current version of CLI",
	Action: func(ctx *cli.Context) error {
		fmt.Println(version.String())
		return nil
	},
}

Functions

func CreateDefaultConfig

func CreateDefaultConfig() *readme.Config

func Execute

func Execute() error

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL