commands.go raw

   1  package podcmds
   2  
   3  import (
   4  	"fmt"
   5  
   6  	"github.com/gookit/color"
   7  
   8  	"github.com/p9c/p9/pod/launchers"
   9  	"github.com/p9c/p9/version"
  10  	"github.com/p9c/p9/pkg/opts/cmds"
  11  )
  12  
  13  // GetCommands returns available subcommands in Parallelcoin Pod
  14  func GetCommands() (c cmds.Commands) {
  15  	c = cmds.Commands{
  16  		{Name: "gui", Title:
  17  		"ParallelCoin GUI Wallet/Miner/Explorer",
  18  			Entrypoint: launchers.GUIHandle,
  19  			Colorizer:  color.Bit24(128, 255, 255, false).Sprint,
  20  			AppText:    "   gui",
  21  		},
  22  		{Name: "version", Title:
  23  		"print version and exit",
  24  			Entrypoint: func(c interface{}) error {
  25  				fmt.Println(version.Tag)
  26  				return nil
  27  			},
  28  		},
  29  		{Name: "ctl", Title:
  30  		"command line wallet and chain RPC client",
  31  			Entrypoint: launchers.CtlHandle,
  32  			Colorizer:  color.Bit24(128, 255, 128, false).Sprint,
  33  			AppText:    "   ctl",
  34  			Commands: []cmds.Command{
  35  				{Name: "list", Title:
  36  				"list available commands",
  37  					Entrypoint: launchers.CtlHandleList,
  38  				},
  39  			},
  40  		},
  41  		{Name: "node", Title:
  42  		"ParallelCoin Blockchain Node",
  43  			Entrypoint: launchers.NodeHandle,
  44  			Colorizer:  color.Bit24(128, 128, 255, false).Sprint,
  45  			AppText:    "  node",
  46  			Description: "The ParallelCoin Node synchronises with the chain" +
  47  			" and can be used to search for block and transaction data as" +
  48  			" well as sending out new transactions.\n" +
  49  			"It can be used as the chain server for a wallet or other" +
  50  			" application server consuming chain data",
  51  			Commands: []cmds.Command{
  52  				{Name: "dropaddrindex", Title:
  53  				"drop the address database index",
  54  					Entrypoint: func(c interface{}) error { return nil },
  55  				},
  56  				{Name: "droptxindex", Title:
  57  				"drop the transaction database index",
  58  					Entrypoint: func(c interface{}) error { return nil },
  59  				},
  60  				{Name: "dropcfindex", Title:
  61  				"drop the cfilter database index",
  62  					Entrypoint: func(c interface{}) error { return nil },
  63  				},
  64  				{Name: "dropindexes", Title:
  65  				"drop all of the indexes",
  66  					Entrypoint: func(c interface{}) error { return nil },
  67  				},
  68  				{Name: "resetchain", Title:
  69  				"deletes the current blockchain cache to force redownload",
  70  					Entrypoint: func(c interface{}) error { return nil },
  71  				},
  72  			},
  73  		},
  74  		{Name: "wallet", Title:
  75  		"run the wallet server (requires a chain node to function)",
  76  			Entrypoint: launchers.WalletHandle, // func(c interface{}) error { return nil },
  77  			Commands: []cmds.Command{
  78  				{Name: "drophistory", Title:
  79  				"reset the wallet transaction history",
  80  					Entrypoint: func(c interface{}) error { return nil },
  81  				},
  82  			},
  83  			Colorizer: color.Bit24(255, 255, 128, false).Sprint,
  84  			AppText:   "wallet",
  85  		},
  86  		{Name: "kopach", Title:
  87  		"standalone multicast miner for easy mining farm deployment",
  88  			Entrypoint: launchers.Kopach,
  89  			Colorizer:  color.Bit24(255, 128, 128, false).Sprint,
  90  			AppText:    "kopach",
  91  		},
  92  		{Name: "worker", Title:
  93  		"single thread worker process, normally started by kopach",
  94  			Entrypoint: launchers.Worker,
  95  			Colorizer:  color.Bit24(255, 128, 255, false).Sprint,
  96  			AppText:    "worker",
  97  		},
  98  	}
  99  	c.PopulateParents(nil)
 100  	// I.S(c)
 101  	return
 102  }
 103  
 104