Skip to content

Commit

Permalink
Add --source flag back to hugo new command
Browse files Browse the repository at this point in the history
v0.15 had it, but I removed it inadvertently for 0.16-DEV
in commit 00d0477 in PR gohugoio#1652.

Also add directory bash-completion for `--source`
for `hugo convert`, `hugo list` and `hugo new`.

See gohugoio#1624, gohugoio#1589
  • Loading branch information
anthonyfok committed Dec 16, 2015
1 parent 41a3af1 commit c1e134f
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 0 deletions.
1 change: 1 addition & 0 deletions commands/convert.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ func init() {
convertCmd.PersistentFlags().StringVarP(&outputDir, "output", "o", "", "filesystem path to write files to")
convertCmd.PersistentFlags().StringVarP(&Source, "source", "s", "", "filesystem path to read files relative from")
convertCmd.PersistentFlags().BoolVar(&unsafe, "unsafe", false, "enable less safe operations, please backup first")
convertCmd.PersistentFlags().SetAnnotation("source", cobra.BashCompSubdirsInDir, []string{})
}

func convertContents(mark rune) (err error) {
Expand Down
1 change: 1 addition & 0 deletions commands/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ func init() {
listCmd.AddCommand(listDraftsCmd)
listCmd.AddCommand(listFutureCmd)
listCmd.PersistentFlags().StringVarP(&Source, "source", "s", "", "filesystem path to read files relative from")
listCmd.PersistentFlags().SetAnnotation("source", cobra.BashCompSubdirsInDir, []string{})
}

var listCmd = &cobra.Command{
Expand Down
2 changes: 2 additions & 0 deletions commands/new.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ func init() {
newSiteCmd.Flags().Bool("force", false, "Init inside non-empty directory")
newCmd.Flags().StringVarP(&configFormat, "format", "f", "toml", "frontmatter format")
newCmd.Flags().StringVarP(&contentType, "kind", "k", "", "Content type to create")
newCmd.PersistentFlags().StringVarP(&Source, "source", "s", "", "filesystem path to read files relative from")
newCmd.PersistentFlags().SetAnnotation("source", cobra.BashCompSubdirsInDir, []string{})
newCmd.AddCommand(newSiteCmd)
newCmd.AddCommand(newThemeCmd)
}
Expand Down

0 comments on commit c1e134f

Please sign in to comment.