-
Notifications
You must be signed in to change notification settings - Fork 74
Description
What is the problem?
Possibly related to #144. There was a change to root.go a few days before the responder commented, and I'm wondering if maybe they just hadn't updated yet.
--config just plain doesn't work. Doesn't do anything. At least in my environment. (Windows 10, cmder)
I think it's because there's no *Run definition on the &cobra.Command struct in root.go. But my familiarity with Go (and thusly cobra/viper) is shaky at best, and I could be totally wrong on that.
I don't think the value of the flag is ever actually being read, or if it is, it's not being provided to the initConfig() function that manages whether or not to use the provided config file or generate one
Operating System
Windows 10 - Using cmder as cmd
Architecture Version (x86, x64, arm, etc)
x86
Steps to reproduce
- Add print statements on lines 48 and 52 of
cmd/root.go, and line 18 ofinternal/util/path.goto monitor control flow. - Create a
.twitch-cli.envfile withCLIENTIDandCLIENTSECRETvariables populated with your app's values. Place this file at the root directory oftwitch-clipackage. - Run any
twitchcommand with the--config ./.twitch-cli.envflag.
Relevant log output
**Verify that my .twitch-cli.env file exists**
C:\Users\ME\go\src\github.com\ME\twitch-cli (main -> origin)
λ [ -f "./.twitch-cli.env" ] && echo true || echo false
true
**Contents of .twitch-cli.env file**
CLIENTSECRET={MyClientSecret}
CLIENTID={MyClientId}
**Attempt twitch configure with --config**
C:\Users\ME\go\src\github.com\ME\twitch-cli (main -> origin)
λ twitch-cli configure --config ./.twitch-cli.env
path.go - Line 18. If this message is printed, it means path was generated instead of read through the persistent flag.
root.go - Line 52. If this message is printed, it means that cfgFile was empty.
path.go - Line 18. If this message is printed, it means path was generated instead of read through the persistent flag.
**Attempt twitch token with --config**
C:\Users\ME\go\src\github.com\ME\twitch-cli (main -> origin)
λ twitch-cli token --config ./.twitch-cli.env
path.go - Line 18. If this message is printed, it means path was generated instead of read through the persistent flag.
root.go - Line 52. If this message is printed, it means that cfgFile was empty.
path.go - Line 18. If this message is printed, it means path was generated instead of read through the persistent flag.
No Client ID or Secret found in configuration. Triggering configuration now.NOTE: I tried enclosing the path string in quotes as well. Same result.