EvaluateTTYOption determines which TTY options are mutually exclusive and returns an error accordingly.
()
| 101 | // EvaluateTTYOption determines which TTY options are mutually exclusive and |
| 102 | // returns an error accordingly. |
| 103 | func (cmd SSHCommand) EvaluateTTYOption() (sharedaction.TTYOption, error) { |
| 104 | var count int |
| 105 | |
| 106 | option := sharedaction.RequestTTYAuto |
| 107 | if cmd.DisablePseudoTTY { |
| 108 | option = sharedaction.RequestTTYNo |
| 109 | count++ |
| 110 | } |
| 111 | if cmd.ForcePseudoTTY { |
| 112 | option = sharedaction.RequestTTYForce |
| 113 | count++ |
| 114 | } |
| 115 | if cmd.RequestPseudoTTY { |
| 116 | option = sharedaction.RequestTTYYes |
| 117 | count++ |
| 118 | } |
| 119 | |
| 120 | if count > 1 { |
| 121 | return option, translatableerror.ArgumentCombinationError{Args: []string{ |
| 122 | "--disable-pseudo-tty", "-T", "--force-pseudo-tty", "--request-pseudo-tty", "-t", |
| 123 | }} |
| 124 | } |
| 125 | |
| 126 | return option, nil |
| 127 | } |
no outgoing calls
no test coverage detected