(args []string, configuration Configuration)
| 119 | } |
| 120 | |
| 121 | func ParseArgs(args []string, configuration Configuration) (command string, parameters []string, newConfiguration Configuration) { |
| 122 | newConfiguration = configuration |
| 123 | |
| 124 | for i := 1; i < len(args); i++ { |
| 125 | arg := args[i] |
| 126 | switch arg { |
| 127 | case "--discard-uncommitted-changes", "-d": |
| 128 | newConfiguration.HandleUncommittedChanges = DiscardChanges |
| 129 | case "--include-uncommitted-changes", "-i": |
| 130 | newConfiguration.HandleUncommittedChanges = IncludeChanges |
| 131 | case "--debug": |
| 132 | // ignore this, already parsed |
| 133 | case "--stay", "-s": |
| 134 | newConfiguration.NextStay = true |
| 135 | case "--return-to-base-branch", "-r": |
| 136 | newConfiguration.NextStay = false |
| 137 | case "--branch", "-b": |
| 138 | if i+1 != len(args) { |
| 139 | newConfiguration.WipBranchQualifier = args[i+1] |
| 140 | } |
| 141 | i++ // skip consumed parameter |
| 142 | case "--message", "-m": |
| 143 | if i+1 != len(args) { |
| 144 | newConfiguration.WipCommitMessage = args[i+1] |
| 145 | } |
| 146 | i++ // skip consumed parameter |
| 147 | case "--squash": |
| 148 | newConfiguration.DoneSquash = Squash |
| 149 | case "--no-squash": |
| 150 | newConfiguration.DoneSquash = NoSquash |
| 151 | case "--squash-wip": |
| 152 | newConfiguration.DoneSquash = SquashWip |
| 153 | case "--create", "-c": |
| 154 | newConfiguration.StartCreate = true |
| 155 | case "--join", "-j": |
| 156 | newConfiguration.StartJoin = true |
| 157 | case "--delete-remote-wip-branch": |
| 158 | newConfiguration.ResetDeleteRemoteWipBranch = true |
| 159 | case "--room": |
| 160 | if i+1 != len(args) { |
| 161 | newConfiguration.TimerRoom = args[i+1] |
| 162 | } |
| 163 | i++ // skip consumed parameter |
| 164 | |
| 165 | default: |
| 166 | if i == 1 { |
| 167 | command = arg |
| 168 | } else { |
| 169 | parameters = append(parameters, arg) |
| 170 | } |
| 171 | } |
| 172 | } |
| 173 | |
| 174 | return |
| 175 | } |
| 176 | |
| 177 | func GetDefaultConfiguration() Configuration { |
| 178 | voiceCommand := "" |
no outgoing calls