-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e4fc058
commit 6a784b1
Showing
7 changed files
with
301 additions
and
3 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
package cmd | ||
|
||
import ( | ||
"fmt" | ||
"os" | ||
"text/tabwriter" | ||
|
||
"github.com/massdriver-cloud/mass/docs/helpdocs" | ||
"github.com/massdriver-cloud/mass/pkg/api" | ||
"github.com/massdriver-cloud/mass/pkg/config" | ||
"github.com/spf13/cobra" | ||
) | ||
|
||
var projCmdHelp = helpdocs.MustRender("project") | ||
var projListCmdHelp = helpdocs.MustRender("project/list") | ||
var projCmd = &cobra.Command{ | ||
Use: "project", | ||
Aliases: []string{"prj"}, | ||
Short: "Manage Projects", | ||
Long: projCmdHelp, | ||
} | ||
|
||
var projListCmd = &cobra.Command{ | ||
Use: `list`, | ||
Short: "List projects", | ||
Aliases: []string{"ls"}, | ||
Long: projListCmdHelp, | ||
RunE: runProjList, | ||
} | ||
|
||
func init() { | ||
rootCmd.AddCommand(projCmd) | ||
projCmd.AddCommand(projListCmd) | ||
} | ||
|
||
func runProjList(cmd *cobra.Command, args []string) error { | ||
config, configErr := config.Get() | ||
if configErr != nil { | ||
return configErr | ||
} | ||
|
||
client := api.NewClient(config.URL, config.APIKey) | ||
|
||
projects, err := api.ListProjects(client, config.OrgID) | ||
|
||
w := tabwriter.NewWriter(os.Stdout, 10, 1, 5, ' ', 0) | ||
fmt.Fprintln(w, "ID\tNAME\tSLUG") | ||
|
||
for _, project := range *projects { | ||
line := fmt.Sprintf("%s\t%s\t%s", project.ID, project.Name, project.Slug) | ||
fmt.Fprintln(w, line) | ||
} | ||
|
||
w.Flush() | ||
|
||
// TODO: present UI | ||
// _, err := commands.DeployPackage(client, config.OrgID, name) | ||
|
||
return err | ||
} |
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,5 @@ | ||
# Manage Projects | ||
|
||
[Projects](https://docs.massdriver.cloud/concepts/projects) act as permission and replication boundaries in Massdriver. | ||
|
||
A project can encompass many environments (permanent or ephemeral) and manages the parity across those environments. |
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,3 @@ | ||
# List Projects | ||
|
||
Lists Massdriver projects. |
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 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 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
Oops, something went wrong.