MCPcopy Index your code
hub / github.com/cloudfoundry/cli / NewSSHOptions

Function NewSSHOptions

cf/ssh/options/ssh_options.go:34–66  ·  view source on GitHub ↗
(fc flags.FlagContext)

Source from the content-addressed store, hash-verified

32}
33
34func NewSSHOptions(fc flags.FlagContext) (*SSHOptions, error) {
35 sshOptions := &SSHOptions{}
36
37 sshOptions.AppName = fc.Args()[0]
38 sshOptions.Index = uint(fc.Int("i"))
39 sshOptions.SkipHostValidation = fc.Bool("k")
40 sshOptions.SkipRemoteExecution = fc.Bool("N")
41 sshOptions.Command = fc.StringSlice("c")
42
43 if fc.IsSet("L") {
44 for _, arg := range fc.StringSlice("L") {
45 forwardSpec, err := sshOptions.parseLocalForwardingSpec(arg)
46 if err != nil {
47 return sshOptions, err
48 }
49 sshOptions.ForwardSpecs = append(sshOptions.ForwardSpecs, *forwardSpec)
50 }
51 }
52
53 if fc.IsSet("t") && fc.Bool("t") {
54 sshOptions.TerminalRequest = RequestTTYYes
55 }
56
57 if fc.IsSet("tt") && fc.Bool("tt") {
58 sshOptions.TerminalRequest = RequestTTYForce
59 }
60
61 if fc.Bool("T") {
62 sshOptions.TerminalRequest = RequestTTYNo
63 }
64
65 return sshOptions, nil
66}
67
68func (o *SSHOptions) parseLocalForwardingSpec(arg string) (*ForwardSpec, error) {
69 arg = strings.TrimSpace(arg)

Callers 2

RequirementsMethod · 0.92

Calls 6

ArgsMethod · 0.65
IntMethod · 0.65
BoolMethod · 0.65
StringSliceMethod · 0.65
IsSetMethod · 0.65

Tested by

no test coverage detected