-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: project create #115
feat: project create #115
Changes from all commits
f3e7fca
c283bde
9653db3
88b416b
98d10ca
f0a5a76
5f50b52
d55ff9b
16acf77
5a94d1f
4d79676
4085d57
b0311f2
15f4428
86c5baa
c86ad72
5d97470
b00c777
086a0aa
cf38f22
a69591d
f79b8f7
2c0d949
57d6f46
487aaa7
91a4f0c
3b5aa46
ec7cbd3
2f2b6d2
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
package cmd | ||
|
||
import ( | ||
"io" | ||
|
||
"github.com/OctopusDeploy/cli/pkg/factory" | ||
"github.com/OctopusDeploy/cli/pkg/question" | ||
"github.com/OctopusDeploy/go-octopusdeploy/v2/pkg/client" | ||
"github.com/OctopusDeploy/go-octopusdeploy/v2/pkg/spaces" | ||
"github.com/spf13/cobra" | ||
) | ||
|
||
type Dependable interface { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I completely understand we're trying to fit within the patterns and idioms of golang... but |
||
Commit() error | ||
GenerateAutomationCmd() | ||
} | ||
|
||
type Dependencies struct { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Perhaps From a quick look, it appears as though this struct is meant to carry services (client, asker) and options (space, noprompt) that are commonly used across many commands? If so, some possible naming suggestions?
... something to think about anyway There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. tag @slewis74 |
||
Out io.Writer | ||
Client *client.Client | ||
Host string | ||
Space *spaces.Space | ||
NoPrompt bool | ||
Ask question.Asker | ||
CmdPath string | ||
ShowMessagePrefix bool | ||
} | ||
|
||
func NewDependencies(f factory.Factory, cmd *cobra.Command) *Dependencies { | ||
client, err := f.GetSpacedClient() | ||
if err != nil { | ||
panic(err) | ||
} | ||
|
||
return &Dependencies{ | ||
Ask: f.Ask, | ||
CmdPath: cmd.CommandPath(), | ||
Out: cmd.OutOrStdout(), | ||
Client: client, | ||
Host: f.GetCurrentHost(), | ||
NoPrompt: !f.IsPromptEnabled(), | ||
Space: f.GetCurrentSpace(), | ||
} | ||
} | ||
|
||
func NewDependenciesFromExisting(opts *Dependencies, cmdPath string) *Dependencies { | ||
return &Dependencies{ | ||
Ask: opts.Ask, | ||
CmdPath: cmdPath, | ||
Out: opts.Out, | ||
Client: opts.Client, | ||
Host: opts.Host, | ||
NoPrompt: opts.NoPrompt, | ||
Space: opts.Space, | ||
ShowMessagePrefix: true, | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
q for @domenicsim1
Given that this isn't a command itself, should it go under the
cmd
directory structure, or should it go under just pkg or pkg/somethingelse?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe, although it is suppose to be the basis of cmds. Not sure yet, happy to leave it for now.