github.com/igggame/nebulas-go@v2.1.0+incompatible/cmd/neb/configcmd.go (about) 1 // Copyright (C) 2017 go-nebulas authors 2 // 3 // This file is part of the go-nebulas library. 4 // 5 // the go-nebulas library is free software: you can redistribute it and/or modify 6 // it under the terms of the GNU General Public License as published by 7 // the Free Software Foundation, either version 3 of the License, or 8 // (at your option) any later version. 9 // 10 // the go-nebulas library is distributed in the hope that it will be useful, 11 // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 // GNU General Public License for more details. 14 // 15 // You should have received a copy of the GNU General Public License 16 // along with the go-nebulas library. If not, see <http://www.gnu.org/licenses/>. 17 // 18 19 package main 20 21 import ( 22 "fmt" 23 24 "github.com/nebulasio/go-nebulas/neblet" 25 "github.com/urfave/cli" 26 ) 27 28 var ( 29 configCommand = cli.Command{ 30 Name: "config", 31 Usage: "Manage config", 32 Category: "CONFIG COMMANDS", 33 Description: ` 34 Manage neblas config, generate a default config file.`, 35 36 Subcommands: []cli.Command{ 37 { 38 Name: "new", 39 Usage: "Generate a default config file", 40 Action: MergeFlags(createDefaultConfig), 41 ArgsUsage: "<filename>", 42 Description: ` 43 Generate a a default config file.`, 44 }, 45 }, 46 } 47 ) 48 49 // accountCreate creates a new account into the keystore 50 func createDefaultConfig(ctx *cli.Context) error { 51 fileName := ctx.Args().First() 52 if len(fileName) == 0 { 53 fmt.Println("please give a config file arg!!!") 54 return nil 55 } 56 neblet.CreateDefaultConfigFile(fileName) 57 fmt.Printf("create default config %s\n", fileName) 58 return nil 59 }