WIP - writing feature / tests for `identity create`

This commit is contained in:
Netscape Navigator 2020-08-11 07:58:39 -05:00
parent 9c49c17a1b
commit a7a87f6b2e
5 changed files with 26 additions and 51 deletions

View File

@ -12,26 +12,26 @@ Don't use the Go version yet. If you want sommething stable, there is a [Ruby ve
|Done?|Verb |Noun | Flag / arg 1 | Flag 2 |
|-----|------------|--------|---------------|-----------|
| |block |peer | user mhash | |
| |create |blob | file Path | |
| |create |blob | pipe | |
| |create |bundle | | |
| |create |draft | | |
| |create |identity| | |
| |find |message | --all | |
| |find |message | --last | |
| |follow |peer | user mhash | |
| |ingest |bundle | | |
| |show |identity| | |
| |create |draft | | |
| |show |blob | | |
| |show |draft | | |
| |show |identity| | |
| |create |blob | file path | |
| |create |blob | pipe | |
| |update |draft | --key=? | --value=? |
| |publish |draft | | |
| |follow |peer | user mhash | |
| |unblock |peer | user mhash | |
| |block |peer | user mhash | |
| |create |bundle | | |
| |find |message | --all | |
| |find |message | --last | |
| |ingest |bundle | | |
| |show |message | message mhash | |
| |show |peers | | |
| |show |peers | --blocked | |
| |sign |draft | | |
| |unblock |peer | user mhash | |
| |unfollow |peer | | |
| |update |draft | --key=? | --value=? |
| X |help | | | |
| X |version | | | |

View File

@ -6,45 +6,25 @@ import (
"github.com/spf13/cobra"
)
// createCmd represents the create command
var createCmd = &cobra.Command{
Use: "create",
Short: "Create various resources (identity, drafts, blob)",
Aliases: []string{"make", "new"},
Long: `A longer description that spans multiple lines and likely contains examples
and usage of using your command. For example:
Cobra is a CLI library for Go that empowers applications.
This application is a tool to generate the needed files
to quickly create a Cobra application.`,
Run: func(cmd *cobra.Command, args []string) {
fmt.Println("create called")
},
}
var identityCmd = &cobra.Command{
Use: "identity",
Short: "Create a new pigeon identity",
Aliases: []string{"id"},
Run: func(cmd *cobra.Command, args []string) {
fmt.Println("create `identity` called")
},
}
func init() {
rootCmd.AddCommand(createCmd)
createCmd.AddCommand(&cobra.Command{
Use: "identity",
Short: "Create a new identity, I think",
Aliases: []string{"id"},
Long: `A longer description that spans multiple lines and likely contains examples
and usage of using your command. For example:
Cobra is a CLI library for Go that empowers applications.
This application is a tool to generate the needed files
to quickly create a Cobra application.`,
Run: func(cmd *cobra.Command, args []string) {
fmt.Println("create called")
},
})
// Here you will define your flags and configuration settings.
// Cobra supports Persistent Flags which will work for this command
// and all subcommands, e.g.:
// createCmd.PersistentFlags().String("foo", "", "A help for foo")
// Cobra supports local flags which will only run when this command
// is called directly, e.g.:
// createCmd.Flags().BoolP("toggle", "t", false, "Help message for toggle")
createCmd.AddCommand(identityCmd)
}

View File

@ -1,8 +0,0 @@
package cmd
import "testing"
func TestCreate(t *testing.T) {
// TODO: Write tests.
t.Fail()
}

1
go.mod
View File

@ -7,6 +7,7 @@ require (
github.com/mitchellh/go-homedir v1.1.0
github.com/mitchellh/mapstructure v1.3.3 // indirect
github.com/pelletier/go-toml v1.8.0 // indirect
github.com/richardlehane/crock32 v1.0.1
github.com/spf13/afero v1.3.2 // indirect
github.com/spf13/cast v1.3.1 // indirect
github.com/spf13/cobra v1.0.0

2
go.sum
View File

@ -154,6 +154,8 @@ github.com/prometheus/common v0.4.0/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y8
github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk=
github.com/prometheus/procfs v0.0.0-20190507164030-5867b95ac084/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA=
github.com/prometheus/tsdb v0.7.1/go.mod h1:qhTCs0VvXwvX/y3TZrWD7rabWM+ijKTux40TwIPHuXU=
github.com/richardlehane/crock32 v1.0.1 h1:GV9EqtAr7RminQ8oGrDt3gYXkzDDPJ5fROaO1Mux14g=
github.com/richardlehane/crock32 v1.0.1/go.mod h1:xUIlLABtHBgs1bNIBdUQR9F2xtRzS0TujtbR68hmEWU=
github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg=
github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4=
github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=