-
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.
Support for new preview environment format (#146)
* Preview environments changes * Output orgs prefixed url, requires that `MASSDRIVER_ORG_ID` be set to the `slug` ID * Nest params, secrets, and remoteRefs * early error mode when params and remoteReferences are present * fmt * init credentials to empty array * fix test for params key loc move * adding project list support * docs update * lint * docs?!?!? * lint + cost
- Loading branch information
1 parent
78f3b18
commit d6e6ee7
Showing
17 changed files
with
583 additions
and
45 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 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, "SLUG\tNAME\tMONTHLY\tDAILY") | ||
|
||
for _, project := range projects { | ||
line := fmt.Sprintf("%s\t%s\t%.2f\t%.2f", project.Slug, project.Name, project.MonthlyAverageCost, project.DailyAverageCost) | ||
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
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,29 @@ | ||
--- | ||
id: mass_project.md | ||
slug: /cli/commands/mass_project | ||
title: Mass Project | ||
sidebar_label: Mass Project | ||
--- | ||
## mass project | ||
|
||
Manage Projects | ||
|
||
### Synopsis | ||
|
||
# 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. | ||
|
||
|
||
### Options | ||
|
||
``` | ||
-h, --help help for project | ||
``` | ||
|
||
### SEE ALSO | ||
|
||
* [mass](/cli/commands/mass) - Massdriver Cloud CLI | ||
* [mass project list](/cli/commands/mass_project_list) - List 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
--- | ||
id: mass_project_list.md | ||
slug: /cli/commands/mass_project_list | ||
title: Mass Project List | ||
sidebar_label: Mass Project List | ||
--- | ||
## mass project list | ||
|
||
List projects | ||
|
||
### Synopsis | ||
|
||
# List Projects | ||
|
||
Lists Massdriver projects. | ||
|
||
|
||
``` | ||
mass project list [flags] | ||
``` | ||
|
||
### Options | ||
|
||
``` | ||
-h, --help help for list | ||
``` | ||
|
||
### SEE ALSO | ||
|
||
* [mass project](/cli/commands/mass_project) - Manage 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
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
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.