GetGlobalFlags returns a struct with all global flag values
()
| 152 | |
| 153 | // GetGlobalFlags returns a struct with all global flag values |
| 154 | func GetGlobalFlags() GlobalFlags { |
| 155 | // Resolve task directory with proper precedence: |
| 156 | // 1. Explicit --task-dir or --dir CLI flag (if changed from default) |
| 157 | // 2. Config file value (supports both "task-dir" and "dir" keys) |
| 158 | // 3. taskDir variable (for tests that set it directly) |
| 159 | // 4. Default "." |
| 160 | dirVal := resolveTaskDir() |
| 161 | |
| 162 | return GlobalFlags{ |
| 163 | Stdin: viper.GetBool("stdin") || stdin, |
| 164 | Quiet: viper.GetBool("quiet") || quiet, |
| 165 | Verbose: viper.GetBool("verbose") || verbose, |
| 166 | Debug: viper.GetBool("debug") || debug, |
| 167 | NoColor: viper.GetBool("no-color") || noColor, |
| 168 | TaskDir: dirVal, |
| 169 | IgnoreDirs: viper.GetStringSlice("ignore"), |
| 170 | Workflow: resolveWorkflow(), |
| 171 | } |
| 172 | } |
| 173 | |
| 174 | // resolveRelativeToConfig resolves a relative path against the config file's directory. |
| 175 | // If the path is absolute, or no config file is loaded, it is returned unchanged. |