go.charczuk.com@v0.0.0-20240327042549-bc490516bd1a/projects/blogctl/main.go (about)

     1  /*
     2  
     3  Copyright (c) 2023 - Present. Will Charczuk. All rights reserved.
     4  Use of this source code is governed by a MIT license that can be found in the LICENSE file at the root of the repository.
     5  
     6  */
     7  
     8  package main
     9  
    10  import (
    11  	"fmt"
    12  	"os"
    13  	"runtime"
    14  
    15  	"github.com/urfave/cli/v2"
    16  
    17  	"go.charczuk.com/projects/blogctl/pkg/cmd"
    18  	"go.charczuk.com/projects/blogctl/pkg/config"
    19  )
    20  
    21  func main() {
    22  	blogctl := &cli.App{
    23  		Name:      "blogctl",
    24  		Usage:     "blogctl helps you build a statically compiled blog.",
    25  		Copyright: "(c) 2019 Will Charczuk",
    26  		Flags: []cli.Flag{
    27  			&cli.StringFlag{
    28  				Name:    config.FlagConfig,
    29  				Aliases: []string{"c"},
    30  				Value:   "config.yml",
    31  				Usage:   "The config path to use for cli settings",
    32  			},
    33  			&cli.BoolFlag{
    34  				Name:  config.FlagDryRun,
    35  				Usage: "If we should show debug output",
    36  			},
    37  			&cli.IntFlag{
    38  				Name:    config.FlagParallelism,
    39  				Aliases: []string{"p"},
    40  				Usage:   "The parallelism, or number of goroutines, to use for parallel operations",
    41  				Value:   runtime.NumCPU(),
    42  			},
    43  		},
    44  		Commands: []*cli.Command{
    45  			cmd.Build(),
    46  			cmd.Clean(),
    47  			cmd.Deploy(),
    48  			cmd.Fix(),
    49  			cmd.Init(),
    50  			cmd.List(),
    51  			cmd.New(),
    52  			cmd.Server(),
    53  		},
    54  	}
    55  	if err := blogctl.Run(os.Args); err != nil {
    56  		fmt.Fprintf(os.Stderr, "%+v\n", err)
    57  		os.Exit(1)
    58  	}
    59  }