URI: 
       commands.go - hugo - [fork] hugo port for 9front
  HTML git clone https://git.drkhsh.at/hugo.git
   DIR Log
   DIR Files
   DIR Refs
   DIR Submodules
   DIR README
   DIR LICENSE
       ---
       commands.go (1908B)
       ---
            1 // Copyright 2024 The Hugo Authors. All rights reserved.
            2 //
            3 // Licensed under the Apache License, Version 2.0 (the "License");
            4 // you may not use this file except in compliance with the License.
            5 // You may obtain a copy of the License at
            6 // http://www.apache.org/licenses/LICENSE-2.0
            7 //
            8 // Unless required by applicable law or agreed to in writing, software
            9 // distributed under the License is distributed on an "AS IS" BASIS,
           10 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
           11 // See the License for the specific language governing permissions and
           12 // limitations under the License.
           13 
           14 package commands
           15 
           16 import (
           17         "context"
           18 
           19         "github.com/bep/simplecobra"
           20 )
           21 
           22 // newExec wires up all of Hugo's CLI.
           23 func newExec() (*simplecobra.Exec, error) {
           24         rootCmd := &rootCommand{
           25                 commands: []simplecobra.Commander{
           26                         newHugoBuildCmd(),
           27                         newVersionCmd(),
           28                         newEnvCommand(),
           29                         newServerCommand(),
           30                         newDeployCommand(),
           31                         newConfigCommand(),
           32                         newNewCommand(),
           33                         newConvertCommand(),
           34                         newImportCommand(),
           35                         newListCommand(),
           36                         newModCommands(),
           37                         newGenCommand(),
           38                         newReleaseCommand(),
           39                 },
           40         }
           41 
           42         return simplecobra.New(rootCmd)
           43 }
           44 
           45 func newHugoBuildCmd() simplecobra.Commander {
           46         return &hugoBuildCommand{}
           47 }
           48 
           49 // hugoBuildCommand just delegates to the rootCommand.
           50 type hugoBuildCommand struct {
           51         rootCmd *rootCommand
           52 }
           53 
           54 func (c *hugoBuildCommand) Commands() []simplecobra.Commander {
           55         return nil
           56 }
           57 
           58 func (c *hugoBuildCommand) Name() string {
           59         return "build"
           60 }
           61 
           62 func (c *hugoBuildCommand) Init(cd *simplecobra.Commandeer) error {
           63         c.rootCmd = cd.Root.Command.(*rootCommand)
           64         return c.rootCmd.initRootCommand("build", cd)
           65 }
           66 
           67 func (c *hugoBuildCommand) PreRun(cd, runner *simplecobra.Commandeer) error {
           68         return c.rootCmd.PreRun(cd, runner)
           69 }
           70 
           71 func (c *hugoBuildCommand) Run(ctx context.Context, cd *simplecobra.Commandeer, args []string) error {
           72         return c.rootCmd.Run(ctx, cd, args)
           73 }