-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* better endpoint collection interface * prepared client and annactl separation * updated glide files * added separate client package to vendor deps * updated vendor deps
- Loading branch information
Showing
40 changed files
with
1,103 additions
and
668 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
package command | ||
|
||
import ( | ||
"github.com/spf13/cobra" | ||
|
||
"github.com/xh3b4sd/anna/annactl/command/endpoint" | ||
"github.com/xh3b4sd/anna/annactl/command/version" | ||
) | ||
|
||
// New creates a new annactl command. | ||
func New() *Command { | ||
command := &Command{} | ||
|
||
command.SetEndpointCommand(endpoint.New()) | ||
command.SetVersionCommand(version.New()) | ||
|
||
return command | ||
} | ||
|
||
// Command represents the annactl command. | ||
type Command struct { | ||
// Dependencies. | ||
|
||
endpointCommand *endpoint.Command | ||
versionCommand *version.Command | ||
} | ||
|
||
// Execute represents the cobra run method. | ||
func (c *Command) Execute(cmd *cobra.Command, args []string) { | ||
cmd.HelpFunc()(cmd, nil) | ||
} | ||
|
||
// New creates a new cobra command for the annactl command. | ||
func (c *Command) New() *cobra.Command { | ||
newCommand := &cobra.Command{ | ||
Use: "annactl", | ||
Short: "Manage the API of the anna project. For more information see https://github.com/the-anna-project/annactl.", | ||
Long: "Manage the API of the anna project. For more information see https://github.com/the-anna-project/annactl.", | ||
Run: c.Execute, | ||
} | ||
|
||
newCommand.AddCommand(c.endpointCommand.New()) | ||
newCommand.AddCommand(c.versionCommand.New()) | ||
|
||
return newCommand | ||
} | ||
|
||
// EndpointCommand returns the endpoint subcommand of the annactl command. | ||
func (c *Command) EndpointCommand() *endpoint.Command { | ||
return c.endpointCommand | ||
} | ||
|
||
// SetEndpointCommand sets the endpoint subcommand for the annactl command. | ||
func (c *Command) SetEndpointCommand(endpointCommand *endpoint.Command) { | ||
c.endpointCommand = endpointCommand | ||
} | ||
|
||
// SetVersionCommand sets the version subcommand for the annactl command. | ||
func (c *Command) SetVersionCommand(versionCommand *version.Command) { | ||
c.versionCommand = versionCommand | ||
} | ||
|
||
// VersionCommand returns the version subcommand of the annactl command. | ||
func (c *Command) VersionCommand() *version.Command { | ||
return c.versionCommand | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
package endpoint | ||
|
||
import ( | ||
"github.com/spf13/cobra" | ||
|
||
"github.com/xh3b4sd/anna/annactl/command/endpoint/text" | ||
) | ||
|
||
// New creates a new endpoint command. | ||
func New() *Command { | ||
command := &Command{} | ||
|
||
command.SetTextCommand(text.New()) | ||
|
||
return command | ||
} | ||
|
||
// Command represents the endpoint command. | ||
type Command struct { | ||
// Settings. | ||
|
||
textCommand *text.Command | ||
} | ||
|
||
// Execute represents the cobra run method. | ||
func (c *Command) Execute(cmd *cobra.Command, args []string) { | ||
cmd.HelpFunc()(cmd, nil) | ||
} | ||
|
||
// New creates a new cobra command for the endpoint command. | ||
func (c *Command) New() *cobra.Command { | ||
newCommand := &cobra.Command{ | ||
Use: "endpoint", | ||
Short: "Manage the network endpoints of the API of the anna project.", | ||
Long: "Manage the network endpoints of the API of the anna project.", | ||
Run: c.Execute, | ||
} | ||
|
||
newCommand.AddCommand(c.textCommand.New()) | ||
|
||
return newCommand | ||
} | ||
|
||
// TextCommand returns the text subcommand of the endpoint command. | ||
func (c *Command) TextCommand() *text.Command { | ||
return c.textCommand | ||
} | ||
|
||
// SetTextCommand sets the text subcommand for the endpoint command. | ||
func (c *Command) SetTextCommand(textCommand *text.Command) { | ||
c.textCommand = textCommand | ||
} |
Oops, something went wrong.