refactor(cli): rename output-dir to output
parent
fc7c594349
commit
2bcc16dd5f
18
main.go
18
main.go
|
@ -24,7 +24,7 @@ const (
|
||||||
markdownFiletype = "md"
|
markdownFiletype = "md"
|
||||||
|
|
||||||
defaultRepositry = currentDir
|
defaultRepositry = currentDir
|
||||||
defaultOutputDir = currentDir
|
defaultOutput = currentDir
|
||||||
defaultFilename = "CHANGELOG"
|
defaultFilename = "CHANGELOG"
|
||||||
defaultFiletype = markdownFiletype
|
defaultFiletype = markdownFiletype
|
||||||
defaultVersion = "0.1.0"
|
defaultVersion = "0.1.0"
|
||||||
|
@ -33,7 +33,7 @@ const (
|
||||||
toFlag = "to"
|
toFlag = "to"
|
||||||
versionFlag = "version"
|
versionFlag = "version"
|
||||||
repositoryFlag = "repository"
|
repositoryFlag = "repository"
|
||||||
outputDirFlag = "output-dir"
|
outputFlag = "output"
|
||||||
filenameFlag = "filename"
|
filenameFlag = "filename"
|
||||||
filetypeFlag = "filetype"
|
filetypeFlag = "filetype"
|
||||||
debugFlag = "debug"
|
debugFlag = "debug"
|
||||||
|
@ -64,13 +64,13 @@ func main() {
|
||||||
},
|
},
|
||||||
&cli.StringFlag{
|
&cli.StringFlag{
|
||||||
Name: repositoryFlag,
|
Name: repositoryFlag,
|
||||||
Usage: "`REPOSITORY` path, example /go/src/myapp",
|
Usage: "`REPOSITORY` directory path, example /go/src/myapp",
|
||||||
DefaultText: defaultRepositry,
|
DefaultText: defaultRepositry,
|
||||||
},
|
},
|
||||||
&cli.StringFlag{
|
&cli.StringFlag{
|
||||||
Name: outputDirFlag,
|
Name: outputFlag,
|
||||||
Usage: "`OUTPUT_DIR` path, example /go/src/myapp",
|
Usage: "`OUTPUT` directory path, example /go/src/myapp",
|
||||||
DefaultText: defaultOutputDir,
|
DefaultText: defaultOutput,
|
||||||
},
|
},
|
||||||
&cli.StringFlag{
|
&cli.StringFlag{
|
||||||
Name: filenameFlag,
|
Name: filenameFlag,
|
||||||
|
@ -79,7 +79,7 @@ func main() {
|
||||||
},
|
},
|
||||||
&cli.StringFlag{
|
&cli.StringFlag{
|
||||||
Name: filetypeFlag,
|
Name: filetypeFlag,
|
||||||
Usage: "output `FILETYPE` support md (markdown)",
|
Usage: "output `FILETYPE`, currently support md (markdown)",
|
||||||
DefaultText: defaultFiletype,
|
DefaultText: defaultFiletype,
|
||||||
},
|
},
|
||||||
&cli.BoolFlag{
|
&cli.BoolFlag{
|
||||||
|
@ -136,7 +136,7 @@ func (a *action) getFlags(c *cli.Context) {
|
||||||
a.flags[toFlag] = c.String(toFlag)
|
a.flags[toFlag] = c.String(toFlag)
|
||||||
a.flags[versionFlag] = a.getFlagValue(c, versionFlag, defaultVersion)
|
a.flags[versionFlag] = a.getFlagValue(c, versionFlag, defaultVersion)
|
||||||
a.flags[repositoryFlag] = a.getFlagValue(c, repositoryFlag, defaultRepositry)
|
a.flags[repositoryFlag] = a.getFlagValue(c, repositoryFlag, defaultRepositry)
|
||||||
a.flags[outputDirFlag] = a.getFlagValue(c, outputDirFlag, defaultOutputDir)
|
a.flags[outputFlag] = a.getFlagValue(c, outputFlag, defaultOutput)
|
||||||
a.flags[filenameFlag] = a.getFlagValue(c, filenameFlag, defaultFilename)
|
a.flags[filenameFlag] = a.getFlagValue(c, filenameFlag, defaultFilename)
|
||||||
a.flags[filetypeFlag] = a.getFlagValue(c, filetypeFlag, defaultFiletype)
|
a.flags[filetypeFlag] = a.getFlagValue(c, filetypeFlag, defaultFiletype)
|
||||||
}
|
}
|
||||||
|
@ -204,7 +204,7 @@ func (a *action) generateChangelog(commits []convention.Commit) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (a *action) getOutputPath() (string, string, string) {
|
func (a *action) getOutputPath() (string, string, string) {
|
||||||
outputDir := a.flags[outputDirFlag]
|
outputDir := a.flags[outputFlag]
|
||||||
filename := a.flags[filenameFlag]
|
filename := a.flags[filenameFlag]
|
||||||
filetype := a.flags[filetypeFlag]
|
filetype := a.flags[filetypeFlag]
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue