Skip to content

Commit

Permalink
More
Browse files Browse the repository at this point in the history
  • Loading branch information
bep committed May 4, 2023
1 parent c1195e5 commit cfa5695
Show file tree
Hide file tree
Showing 8 changed files with 670 additions and 36 deletions.
9 changes: 0 additions & 9 deletions commandsnew/completion.go

This file was deleted.

27 changes: 27 additions & 0 deletions commandsnew/helpers.go
Original file line number Diff line number Diff line change
@@ -1,11 +1,18 @@
package commandsnew

import (
"bytes"
"errors"
"fmt"
"log"
"os"
"path/filepath"
"strings"

"github.com/bep/simplecobra"
"github.com/gohugoio/hugo/config"
"github.com/gohugoio/hugo/helpers"
"github.com/spf13/afero"
"github.com/spf13/pflag"
)

Expand Down Expand Up @@ -80,3 +87,23 @@ func setValueFromFlag(flags *pflag.FlagSet, key string, cfg config.Provider, tar

}
}

func newUserError(a ...any) *simplecobra.CommandError {
return &simplecobra.CommandError{Err: errors.New(fmt.Sprint(a...))}
}

func mkdir(x ...string) {
p := filepath.Join(x...)
err := os.MkdirAll(p, 0777) // before umask
if err != nil {
log.Fatal(err)
}
}

func touchFile(fs afero.Fs, filename string) {
mkdir(filepath.Dir(filename))
err := helpers.WriteToDisk(filename, bytes.NewReader([]byte{}), fs)
if err != nil {
log.Fatal(err)
}
}
2 changes: 1 addition & 1 deletion commandsnew/hugo.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,10 @@ func newExec() (*simplecobra.Exec, error) {
newDeployCommand(),
newConfigCommand(),
newNewCommand(),
newImportCommand(),
newListCommand(),
newModCommands(),
newGenCommand(),
newCompletionCommand(),
},
}

Expand Down
Loading

0 comments on commit cfa5695

Please sign in to comment.