github.com/silveraid/fabric-ca@v1.1.0-preview.0.20180127000700-71974f53ab08/cmd/fabric-ca-client/main.go (about) 1 /* 2 Copyright IBM Corp. 2017 All Rights Reserved. 3 4 Licensed under the Apache License, Version 2.0 (the "License"); 5 you may not use this file except in compliance with the License. 6 You may obtain a copy of the License at 7 8 http://www.apache.org/licenses/LICENSE-2.0 9 10 Unless required by applicable law or agreed to in writing, software 11 distributed under the License is distributed on an "AS IS" BASIS, 12 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 See the License for the specific language governing permissions and 14 limitations under the License. 15 */ 16 17 package main 18 19 import ( 20 "os" 21 ) 22 23 // The fabric-ca client main 24 func main() { 25 if err := RunMain(os.Args); err != nil { 26 os.Exit(1) 27 } 28 } 29 30 // RunMain is the fabric-ca client main 31 func RunMain(args []string) error { 32 // Save the os.Args 33 saveOsArgs := os.Args 34 os.Args = args 35 36 // Execute the command 37 cmdName := "" 38 if len(args) > 1 { 39 cmdName = args[1] 40 } 41 ccmd := NewCommand(cmdName) 42 err := ccmd.Execute() 43 44 // Restore original os.Args 45 os.Args = saveOsArgs 46 47 return err 48 }