scottdomini
scottdomini

Reputation: 35

Configure a default directory path in Go with Cobra and Viper

I want the user of my CLI app to enter a specific path where they want to save files. I tried to use Cobra's --config flag but I don't know how to.

Example:

app --config path "~/Documents/"

How could I do this?

Upvotes: 2

Views: 696

Answers (1)

emptyhua
emptyhua

Reputation: 6692

You could try to sepcify a absolute path.

app --config path "$HOME/Documents/"

Upvotes: 1

Related Questions