forked from keybase/client
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add types and plumbing for listing popular assets from stellard (keyb…
- Loading branch information
Showing
16 changed files
with
193 additions
and
0 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,62 @@ | ||
package client | ||
|
||
import ( | ||
"errors" | ||
|
||
"github.com/keybase/cli" | ||
"github.com/keybase/client/go/libcmdline" | ||
"github.com/keybase/client/go/libkb" | ||
"golang.org/x/net/context" | ||
) | ||
|
||
func (c *cmdWalletPopularAssets) GetUsage() libkb.Usage { | ||
return libkb.Usage{ | ||
API: true, | ||
KbKeyring: true, | ||
Config: true, | ||
} | ||
} | ||
|
||
type cmdWalletPopularAssets struct { | ||
libkb.Contextified | ||
} | ||
|
||
func newCmdWalletPopularAssets(cl *libcmdline.CommandLine, g *libkb.GlobalContext) cli.Command { | ||
cmd := &cmdWalletPopularAssets{ | ||
Contextified: libkb.NewContextified(g), | ||
} | ||
return cli.Command{ | ||
Name: "popular-assets", | ||
Usage: "List popular assets", | ||
Action: func(c *cli.Context) { | ||
cl.ChooseCommand(cmd, "popular-assets", c) | ||
}, | ||
} | ||
} | ||
|
||
func (c *cmdWalletPopularAssets) ParseArgv(ctx *cli.Context) error { | ||
if len(ctx.Args()) != 0 { | ||
return errors.New("listing popular assets expects no args") | ||
} | ||
return nil | ||
} | ||
|
||
func (c *cmdWalletPopularAssets) Run() (err error) { | ||
defer transformStellarCLIError(&err) | ||
|
||
cli, err := GetWalletClient(c.G()) | ||
if err != nil { | ||
return err | ||
} | ||
|
||
assets, err := cli.ListPopularAssetsLocal(context.Background(), 0) | ||
if err != nil { | ||
return err | ||
} | ||
dui := c.G().UI.GetDumbOutputUI() | ||
dui.Printf("popular assets:\n") | ||
for _, asset := range assets { | ||
dui.Printf(buildOutputStringForAsset(asset) + "\n") | ||
} | ||
return nil | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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
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
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.