MCPcopy Create free account
hub / github.com/OctopusDeploy/cli / NewCmdView

Function NewCmdView

pkg/cmd/project/view/view.go:46–81  ·  view source on GitHub ↗
(f factory.Factory)

Source from the content-addressed store, hash-verified

44}
45
46func NewCmdView(f factory.Factory) *cobra.Command {
47 viewFlags := NewViewFlags()
48 cmd := &cobra.Command{
49 Args: usage.ExactArgs(1),
50 Use: "view {<name> | <id> | <slug>}",
51 Short: "View a project",
52 Long: "View a project in Octopus Deploy",
53 Example: heredoc.Docf(`
54 %[1]s project view 'Deploy Web App'
55 %[1]s project view Projects-9000
56 %[1]s project view deploy-web-app
57 `, constants.ExecutableName),
58 RunE: func(cmd *cobra.Command, args []string) error {
59 client, err := f.GetSpacedClient(apiclient.NewRequester(cmd))
60 if err != nil {
61 return err
62 }
63
64 opts := &ViewOptions{
65 client,
66 f.GetCurrentHost(),
67 cmd.OutOrStdout(),
68 args[0],
69 viewFlags,
70 cmd,
71 }
72
73 return viewRun(opts)
74 },
75 }
76
77 flags := cmd.Flags()
78 flags.BoolVarP(&viewFlags.Web.Value, viewFlags.Web.Name, "w", false, "Open in web browser")
79
80 return cmd
81}
82
83func viewRun(opts *ViewOptions) error {
84 project, err := opts.Client.Projects.GetByIdentifier(opts.idOrName)

Callers

nothing calls this directly

Calls 6

ExactArgsFunction · 0.92
NewRequesterFunction · 0.92
NewViewFlagsFunction · 0.70
viewRunFunction · 0.70
GetSpacedClientMethod · 0.65
GetCurrentHostMethod · 0.65

Tested by

no test coverage detected