mirror of
https://github.com/fnproject/fn.git
synced 2022-10-28 21:29:17 +03:00
fn: improve UX (#325)
* fn: make UX more consistent with regards to app name position * fn: improve detection of missing routes * fn: fix update operations - No longer delete-than-add for configuration updates - Path cleaning before most of routes operations
This commit is contained in:
committed by
Seif Lotfy سيف لطفي
parent
e2e82086c5
commit
fe845e1886
77
fn/apps.go
77
fn/apps.go
@@ -20,14 +20,15 @@ func apps() cli.Command {
|
||||
|
||||
return cli.Command{
|
||||
Name: "apps",
|
||||
Usage: "list apps",
|
||||
Usage: "operate applications",
|
||||
ArgsUsage: "fn apps",
|
||||
Action: a.list,
|
||||
Subcommands: []cli.Command{
|
||||
{
|
||||
Name: "create",
|
||||
Usage: "create a new app",
|
||||
Action: a.create,
|
||||
Name: "create",
|
||||
Aliases: []string{"c"},
|
||||
Usage: "create a new app",
|
||||
ArgsUsage: "`app`",
|
||||
Action: a.create,
|
||||
Flags: []cli.Flag{
|
||||
cli.StringSliceFlag{
|
||||
Name: "config",
|
||||
@@ -36,31 +37,45 @@ func apps() cli.Command {
|
||||
},
|
||||
},
|
||||
{
|
||||
Name: "config",
|
||||
Usage: "operate an application configuration set",
|
||||
Action: a.configList,
|
||||
Flags: []cli.Flag{
|
||||
cli.BoolFlag{
|
||||
Name: "shell",
|
||||
Usage: "output in shell format",
|
||||
},
|
||||
cli.BoolFlag{
|
||||
Name: "json",
|
||||
Usage: "output in JSON format",
|
||||
},
|
||||
},
|
||||
Name: "list",
|
||||
Aliases: []string{"l"},
|
||||
Usage: "list all apps",
|
||||
Action: a.list,
|
||||
},
|
||||
{
|
||||
Name: "config",
|
||||
Usage: "operate an application configuration set",
|
||||
Subcommands: []cli.Command{
|
||||
{
|
||||
Name: "set",
|
||||
Description: "store a configuration key for this application",
|
||||
Usage: "<app> <key> <value>",
|
||||
Action: a.configSet,
|
||||
Name: "view",
|
||||
Aliases: []string{"v"},
|
||||
Usage: "view all configuration keys for this app",
|
||||
ArgsUsage: "`app`",
|
||||
Action: a.configList,
|
||||
Flags: []cli.Flag{
|
||||
cli.BoolFlag{
|
||||
Name: "shell,s",
|
||||
Usage: "output in shell format",
|
||||
},
|
||||
cli.BoolFlag{
|
||||
Name: "json,j",
|
||||
Usage: "output in JSON format",
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
Name: "unset",
|
||||
Description: "remove a configuration key for this application",
|
||||
Usage: "<app> <key> <value>",
|
||||
Action: a.configUnset,
|
||||
Name: "set",
|
||||
Aliases: []string{"s"},
|
||||
Usage: "store a configuration key for this application",
|
||||
ArgsUsage: "`app` <key> <value>",
|
||||
Action: a.configSet,
|
||||
},
|
||||
{
|
||||
Name: "unset",
|
||||
Aliases: []string{"u"},
|
||||
Usage: "remove a configuration key for this application",
|
||||
ArgsUsage: "`app` <key>",
|
||||
Action: a.configUnset,
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -69,7 +84,7 @@ func apps() cli.Command {
|
||||
}
|
||||
|
||||
func (a *appsCmd) list(c *cli.Context) error {
|
||||
if err := resetBasePath(&a.Configuration); err != nil {
|
||||
if err := resetBasePath(a.Configuration); err != nil {
|
||||
return fmt.Errorf("error setting endpoint: %v", err)
|
||||
}
|
||||
|
||||
@@ -95,7 +110,7 @@ func (a *appsCmd) create(c *cli.Context) error {
|
||||
return errors.New("error: app creating takes one argument, an app name")
|
||||
}
|
||||
|
||||
if err := resetBasePath(&a.Configuration); err != nil {
|
||||
if err := resetBasePath(a.Configuration); err != nil {
|
||||
return fmt.Errorf("error setting endpoint: %v", err)
|
||||
}
|
||||
|
||||
@@ -117,7 +132,7 @@ func (a *appsCmd) configList(c *cli.Context) error {
|
||||
return errors.New("error: app description takes one argument, an app name")
|
||||
}
|
||||
|
||||
if err := resetBasePath(&a.Configuration); err != nil {
|
||||
if err := resetBasePath(a.Configuration); err != nil {
|
||||
return fmt.Errorf("error setting endpoint: %v", err)
|
||||
}
|
||||
|
||||
@@ -157,7 +172,7 @@ func (a *appsCmd) configSet(c *cli.Context) error {
|
||||
return errors.New("error: application configuration setting takes three arguments: an app name, a key and a value")
|
||||
}
|
||||
|
||||
if err := resetBasePath(&a.Configuration); err != nil {
|
||||
if err := resetBasePath(a.Configuration); err != nil {
|
||||
return fmt.Errorf("error setting endpoint: %v", err)
|
||||
}
|
||||
|
||||
@@ -191,7 +206,7 @@ func (a *appsCmd) configUnset(c *cli.Context) error {
|
||||
return errors.New("error: application configuration setting takes three arguments: an app name, a key and a value")
|
||||
}
|
||||
|
||||
if err := resetBasePath(&a.Configuration); err != nil {
|
||||
if err := resetBasePath(a.Configuration); err != nil {
|
||||
return fmt.Errorf("error setting endpoint: %v", err)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user