cobra/zsh_completions.go
Line 265
in
6d978a9
if eval _describe "completions" completions $flagPrefix $noSpace; then
The way describes works with the following input - apple cat b...
I might be misunderstanding something or my approach is wrong but I am having trouble achieving something.
What I want
I want to have a REQUIRED parameter on a command, lets call it Important URL.
I want to be able to set it as a ENVIRONMENT VARIABLE or override it on the cli with a FLAG.
The logic...
I'm working on an exec command which wants to take in a few well defined and validated args/flags, followed by arbitrary args/flags after the '--' terminator which will be passed on to another binary:
rootCmd exec arg1 -flag1 -- arg2 arg3.
The following functionality would have saved me a lot of boi...
the code here contains the main logic when executing a command:
cobra/command.go
Lines 939 to 963
in
4fa4fdf
if c.RunE != nil {
if err := c.RunE(c, argWoFlags); err...
Here is an example of how you can add more networks cards to a VM with libvirt.
#!/bin/bash
cd=suse
name=suse
virt-install \
--virt-type=kvm \
--name $name \
--ram 2048 \
--vcpus=2 \
--os-variant=generic \
--cdrom="/var/lib/libvirt/boot/$cd.iso" \
--network=bridge=br0,model=virtio \
--network=brid...
hey, thanks for cool library, I have only a one question:
func pkgDefineFileAndUrlFlags(cmd *cobra.Command) {
cmd.Flags().String("file", "", "Local ZIP path")
cmd.Flags().String("url", "", "URL to ZIP")
cmd.MarkFlagsMutuallyExclusive("file", "url")
}
how to make only one of flags defined required...
I have a command:
func Command() *cobra.Command {
command := &cobra.Command{}
}
And I'm setting some flags:
command.Flags().StringVar(&region, "region", "", "The AWS Region to use.")
command.Flags().StringVar(&name, "name", "", "Unique name to use for your bastion.")
command.Flags()....