Hello, i want to use command line flags/argument.
Like ,
MYSOFT -g FILE
in flags.String , it will work properly but if we do not pass any argument after -g flag then it will say :
flag needs an argument: -g
Usage of ./MYSOFT:
-g string
(default "install")
i want that if flag arugment is empty that it should show :
Please Parse an argument to install
actually, the thing i want is, if someone run MYSOFT command then the output should like this :
Usage: <options> software
MYSOFT Options:
-i, --install, install Install Software
You must have the name of the software you want to install or update, so you can use this command.
and if someone run MYSOFT -i , then the output should like this :
Please enter any software, the selected software doesn't exists
and if someone run MYSOFT -i CALCULATOR
it will execute some codes
i have tried to do it also via os.Args , but in everything it doesn’t works properly.
when i have add these lines via fmt.Println :
Usage: <options> software
MYSOFT Options:
-i, --install, install Install Software
You must have the name of the software you want to install or update, so you can use this command.
then if i run MYSOFT -i CALCULATOR then the above string also comes
anyone know how can i do it