#Custom acronyms for function flags?

1 messages · Page 1 of 1 (latest)

short obsidian
#

Hey 🙂

Is it somehow possible to define acronyms for the flags that are generated out of function arguments?

For instance I currently have something like this:

package main

import "fmt"

type Test struct{}

func (m *Test) WithArgs(
    // +optional
    // +default="dummy"
    k8sName string,
) error {
    fmt.Println(k8sName)
    return nil
}

But the flag is generated as --k-8-s-name while the input argument in the dagger.gen.go file is k8sName:

❯ dagger call with-args --help
Setup tracing at https://dagger.cloud/traces/setup. To hide: export GOAWAY=1

✔ connect 1.2s
✔ initialize 1.7s
✔ prepare 0.0s

USAGE
  dagger call with-args [arguments]

ARGUMENTS
      --k-8-s-name string    (default "dummy")
❯ dagger call with-args
Setup tracing at https://dagger.cloud/traces/setup. To hide: export SHUTUP=1

✔ connect 1.1s
✔ initialize 0.3s
✔ prepare 0.0s

Error: response from query: input: test.withArgs resolve: failed to find arg "k8SName"

Ideally, I'd like to have the flag be named --k8s-name. I tried setting up an strcase acronym directly in the module but that's probably to late. What else could I try? 🙂

dull cove
#

I don't think it's currently possible. cc @olive elm

olive elm
#

It's possible in Python and TS to override the name of a function/argument but not Go atm.