Esempio n. 1
0
const fabric = "hyperledger"
const nodeFuncName = "node"
const networkFuncName = "network"
const chainFuncName = "chaincode"
const cmdRoot = "core"
const undefinedParamValue = ""

// The main command describes the service and
// defaults to printing the help message.
var mainCmd = &cobra.Command{
	Use: "peer",
	PersistentPreRunE: func(cmd *cobra.Command, args []string) error {
		return core.CacheConfiguration()
	},
	PreRun: func(cmd *cobra.Command, args []string) {
		core.LoggingInit("peer")
	},
	Run: func(cmd *cobra.Command, args []string) {
		if versionFlag {
			showVersion()
		} else {
			cmd.HelpFunc()(cmd, args)
		}
	},
	PersistentPostRunE: func(cmd *cobra.Command, args []string) error {
		return nil
	},
}

var versionCmd = &cobra.Command{
	Use:   "version",
Esempio n. 2
0
// The main command describes the service and
// defaults to printing the help message.
var mainCmd = &cobra.Command{
	Use: "peer",
	PersistentPreRunE: func(cmd *cobra.Command, args []string) error {
		return core.CacheConfiguration()
	},
}

var nodeCmd = &cobra.Command{
	Use:   nodeFuncName,
	Short: fmt.Sprintf("%s specific commands.", nodeFuncName),
	Long:  fmt.Sprintf("%s specific commands.", nodeFuncName),
	PersistentPreRun: func(cmd *cobra.Command, args []string) {
		core.LoggingInit(nodeFuncName)
	},
}

var nodeStartCmd = &cobra.Command{
	Use:   "start",
	Short: "Starts the node.",
	Long:  `Starts a node that interacts with the network.`,
	RunE: func(cmd *cobra.Command, args []string) error {
		return serve(args)
	},
}

var nodeStatusCmd = &cobra.Command{
	Use:   "status",
	Short: "Returns status of the node.",
Esempio n. 3
0
// The main command describes the service and
// defaults to printing the help message.
var mainCmd = &cobra.Command{
	Use: "peer",
	PersistentPreRunE: func(cmd *cobra.Command, args []string) error {
		return core.CacheConfiguration()
	},
}

var peerCmd = &cobra.Command{
	Use:   "peer",
	Short: "Runs the peer.",
	Long:  `Runs a peer that interacts with the network.`,
	PersistentPreRun: func(cmd *cobra.Command, args []string) {
		core.LoggingInit("peer")
	},
	RunE: func(cmd *cobra.Command, args []string) error {
		return serve(args)
	},
}

var statusCmd = &cobra.Command{
	Use:   "status",
	Short: "Returns status of the peer.",
	Long:  `Returns the status of the currently running peer.`,
	PersistentPreRun: func(cmd *cobra.Command, args []string) {
		core.LoggingInit("status")
	},
	Run: func(cmd *cobra.Command, args []string) {
		status()