main: add -t option to set temp dir
This commit is contained in:
parent
fa1faeaa9f
commit
8553658128
1 changed files with 6 additions and 0 deletions
6
main.go
6
main.go
|
|
@ -19,6 +19,7 @@ const version = "0-pre"
|
|||
|
||||
var addr *string
|
||||
var port *uint16
|
||||
var tempDir *string
|
||||
var deleteAndExit *bool
|
||||
var regenerate *bool
|
||||
var showVersion *bool
|
||||
|
|
@ -26,6 +27,7 @@ var showVersion *bool
|
|||
func main() {
|
||||
addr = getopt.String('a', "0.0.0.0")
|
||||
port = getopt.Uint16('p', 8000)
|
||||
tempDir = getopt.String('t', "")
|
||||
deleteAndExit = getopt.Bool('d')
|
||||
regenerate = getopt.Bool('r')
|
||||
showVersion = getopt.Bool('V')
|
||||
|
|
@ -33,6 +35,10 @@ func main() {
|
|||
util.Die(err.Error())
|
||||
}
|
||||
|
||||
if len(*tempDir) != 0 {
|
||||
musicindex.TempDir = *tempDir
|
||||
}
|
||||
|
||||
if *deleteAndExit {
|
||||
err := os.RemoveAll(musicindex.TempDir)
|
||||
if err != nil {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue