(args []string)
| 182 | } |
| 183 | |
| 184 | func NewArgs(args []string) *Args { |
| 185 | var ( |
| 186 | command string |
| 187 | params []string |
| 188 | noop bool |
| 189 | ) |
| 190 | |
| 191 | cmdIdx := findCommandIndex(args) |
| 192 | globalFlags := args[:cmdIdx] |
| 193 | if cmdIdx > 0 { |
| 194 | args = args[cmdIdx:] |
| 195 | for i := len(globalFlags) - 1; i >= 0; i-- { |
| 196 | if globalFlags[i] == noopFlag { |
| 197 | noop = true |
| 198 | globalFlags = append(globalFlags[:i], globalFlags[i+1:]...) |
| 199 | } |
| 200 | } |
| 201 | } |
| 202 | |
| 203 | if len(args) != 0 { |
| 204 | command = args[0] |
| 205 | params = args[1:] |
| 206 | } |
| 207 | |
| 208 | return &Args{ |
| 209 | Executable: "git", |
| 210 | GlobalFlags: globalFlags, |
| 211 | Command: command, |
| 212 | Params: params, |
| 213 | Noop: noop, |
| 214 | beforeChain: make([]*cmd.Cmd, 0), |
| 215 | afterChain: make([]*cmd.Cmd, 0), |
| 216 | } |
| 217 | } |
| 218 | |
| 219 | const ( |
| 220 | noopFlag = "--noop" |
searching dependent graphs…