-
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 version command * fix to pendingNonceAt * fix command init * add version comment * fix log * remove todo * fix check signing status error * remove get effectiveGas * fix comment
- Loading branch information
Showing
10 changed files
with
144 additions
and
306 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
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,59 @@ | ||
package cmd | ||
|
||
import ( | ||
"fmt" | ||
"runtime" | ||
"strings" | ||
|
||
"github.com/pelletier/go-toml/v2" | ||
"github.com/spf13/cobra" | ||
|
||
"github.com/bandprotocol/falcon/relayer" | ||
) | ||
|
||
var ( | ||
// Version defines the application version (defined at compile time) | ||
Version = "" | ||
Commit = "" | ||
Dirty = "" | ||
) | ||
|
||
type versionInfo struct { | ||
Version string `json:"version" yaml:"version"` | ||
Commit string `json:"commit" yaml:"commit"` | ||
Go string `json:"go" yaml:"go"` | ||
} | ||
|
||
// versionCmd returns a command that prints the falcon version information. | ||
func versionCmd(_ *relayer.App) *cobra.Command { | ||
versionCmd := &cobra.Command{ | ||
Use: "version", | ||
Aliases: []string{"v"}, | ||
Short: "Print the falcon version info", | ||
Args: withUsage(cobra.NoArgs), | ||
Example: strings.TrimSpace(fmt.Sprintf(` | ||
$ %s version | ||
$ %s v`, | ||
appName, appName, | ||
)), | ||
RunE: func(cmd *cobra.Command, args []string) error { | ||
commit := Commit | ||
if Dirty != "0" { | ||
commit += " (dirty)" | ||
} | ||
|
||
verInfo := versionInfo{ | ||
Version: Version, | ||
Commit: commit, | ||
Go: fmt.Sprintf("%s %s/%s", runtime.Version(), runtime.GOOS, runtime.GOARCH), | ||
} | ||
|
||
bz, err := toml.Marshal(&verInfo) | ||
|
||
fmt.Fprintln(cmd.OutOrStdout(), string(bz)) | ||
return err | ||
}, | ||
} | ||
|
||
return versionCmd | ||
} |
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.