-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* New policy syntax * accept an old policy syntax with a warning * Fix unit tests Co-authored-by: Daniele Lisi <[email protected]>
- Loading branch information
1 parent
9102a42
commit 5a37552
Showing
12 changed files
with
275 additions
and
114 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
package commands | ||
|
||
import ( | ||
"os" | ||
"text/template" | ||
|
||
"github.com/ecadlabs/signatory/pkg/tezos" | ||
"github.com/spf13/cobra" | ||
) | ||
|
||
const listReqTemplateSrc = `Possible request types: | ||
{{- range .}} | ||
- {{.}} | ||
{{- end}} | ||
` | ||
|
||
const listOpsTemplateSrc = `Possible operation types: | ||
{{- range .}} | ||
- {{.}} | ||
{{- end}} | ||
` | ||
|
||
var ( | ||
listReqTpl = template.Must(template.New("list").Parse(listReqTemplateSrc)) | ||
listOpsTpl = template.Must(template.New("list").Parse(listOpsTemplateSrc)) | ||
) | ||
|
||
func NewListRequests(c *Context) *cobra.Command { | ||
cmd := &cobra.Command{ | ||
Use: "list-requests", | ||
Short: "Print possible request types", | ||
RunE: func(cmd *cobra.Command, args []string) error { | ||
return listReqTpl.Execute(os.Stdout, tezos.RequestKinds) | ||
}, | ||
} | ||
|
||
return cmd | ||
} | ||
|
||
func NewListOps(c *Context) *cobra.Command { | ||
cmd := &cobra.Command{ | ||
Use: "list-ops", | ||
Short: "Print possible operation types inside the `generic` request", | ||
RunE: func(cmd *cobra.Command, args []string) error { | ||
return listOpsTpl.Execute(os.Stdout, tezos.Operations) | ||
}, | ||
} | ||
|
||
return cmd | ||
} |
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
Oops, something went wrong.