Skip to content

Commit

Permalink
Merge pull request #172 from superfly/codepope/issue171
Browse files Browse the repository at this point in the history
No easy way to get just the app name from flyctl
  • Loading branch information
codepope committed Jun 29, 2020
2 parents 3638b79 + c096e2e commit e00d1f1
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion cmd/appInfo.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,15 @@ import (

func newAppInfoCommand() *Command {
ks := docstrings.Get("info")
return BuildCommand(nil, runAppInfo, ks.Usage, ks.Short, ks.Long, os.Stdout, requireSession, requireAppName)
appInfoCmd := BuildCommand(nil, runAppInfo, ks.Usage, ks.Short, ks.Long, os.Stdout, requireSession, requireAppName)

appInfoCmd.AddBoolFlag(BoolFlagOpts{
Name: "name",
Shorthand: "n",
Description: "Returns just the appname",
})

return appInfoCmd
}

func runAppInfo(ctx *cmdctx.CmdContext) error {
Expand All @@ -21,6 +29,11 @@ func runAppInfo(ctx *cmdctx.CmdContext) error {
return err
}

if ctx.Config.GetBool("name") {
ctx.Status("info", cmdctx.SINFO, app.Name)
return nil
}

err = ctx.Frender(cmdctx.PresenterOption{Presentable: &presenters.AppCompact{AppCompact: *app}, HideHeader: true, Vertical: true, Title: "App"})
if err != nil {
return err
Expand Down

0 comments on commit e00d1f1

Please sign in to comment.