// Generated by Lisette bindgen
// Source: flag (Go stdlib)
// Go: 1.25.10
// Lisette: 0.2.1

import "go:encoding"
import "go:io"
import "go:time"

pub enum ErrorHandling: int {
  ContinueOnError = 0,
  ExitOnError = 1,
  PanicOnError = 2,
}

pub const ContinueOnError: ErrorHandling = 0

pub const ExitOnError: ErrorHandling = 1

pub const PanicOnError: ErrorHandling = 2

/// Arg returns the i'th command-line argument. Arg(0) is the first remaining argument
/// after flags have been processed. Arg returns an empty string if the
/// requested element does not exist.
pub fn Arg(i: int) -> string

/// Args returns the non-flag command-line arguments.
pub fn Args() -> Slice<string>

/// Bool defines a bool flag with specified name, default value, and usage string.
/// The return value is the address of a bool variable that stores the value of the flag.
pub fn Bool(name: string, value: bool, usage: string) -> Ref<bool>

/// BoolFunc defines a flag with the specified name and usage string without requiring values.
/// Each time the flag is seen, fn is called with the value of the flag.
/// If fn returns a non-nil error, it will be treated as a flag value parsing error.
pub fn BoolFunc(
  name: string,
  usage: string,
  fn_: fn(string) -> Result<(), error>,
)

/// BoolVar defines a bool flag with specified name, default value, and usage string.
/// The argument p points to a bool variable in which to store the value of the flag.
pub fn BoolVar(p: Ref<bool>, name: string, value: bool, usage: string)

/// Duration defines a time.Duration flag with specified name, default value, and usage string.
/// The return value is the address of a time.Duration variable that stores the value of the flag.
/// The flag accepts a value acceptable to time.ParseDuration.
pub fn Duration(name: string, value: time.Duration, usage: string) -> Ref<time.Duration>

/// DurationVar defines a time.Duration flag with specified name, default value, and usage string.
/// The argument p points to a time.Duration variable in which to store the value of the flag.
/// The flag accepts a value acceptable to time.ParseDuration.
pub fn DurationVar(
  p: Ref<time.Duration>,
  name: string,
  value: time.Duration,
  usage: string,
)

/// Float64 defines a float64 flag with specified name, default value, and usage string.
/// The return value is the address of a float64 variable that stores the value of the flag.
pub fn Float64(name: string, value: float64, usage: string) -> Ref<float64>

/// Float64Var defines a float64 flag with specified name, default value, and usage string.
/// The argument p points to a float64 variable in which to store the value of the flag.
pub fn Float64Var(p: Ref<float64>, name: string, value: float64, usage: string)

/// Func defines a flag with the specified name and usage string.
/// Each time the flag is seen, fn is called with the value of the flag.
/// If fn returns a non-nil error, it will be treated as a flag value parsing error.
pub fn Func(name: string, usage: string, fn_: fn(string) -> Result<(), error>)

/// Int defines an int flag with specified name, default value, and usage string.
/// The return value is the address of an int variable that stores the value of the flag.
pub fn Int(name: string, value: int, usage: string) -> Ref<int>

/// Int64 defines an int64 flag with specified name, default value, and usage string.
/// The return value is the address of an int64 variable that stores the value of the flag.
pub fn Int64(name: string, value: int64, usage: string) -> Ref<int64>

/// Int64Var defines an int64 flag with specified name, default value, and usage string.
/// The argument p points to an int64 variable in which to store the value of the flag.
pub fn Int64Var(p: Ref<int64>, name: string, value: int64, usage: string)

/// IntVar defines an int flag with specified name, default value, and usage string.
/// The argument p points to an int variable in which to store the value of the flag.
pub fn IntVar(p: Ref<int>, name: string, value: int, usage: string)

/// Lookup returns the [Flag] structure of the named command-line flag,
/// returning nil if none exists.
pub fn Lookup(name: string) -> Option<Ref<Flag>>

/// NArg is the number of arguments remaining after flags have been processed.
pub fn NArg() -> int

/// NFlag returns the number of command-line flags that have been set.
pub fn NFlag() -> int

/// NewFlagSet returns a new, empty flag set with the specified name and
/// error handling property. If the name is not empty, it will be printed
/// in the default usage message and in error messages.
pub fn NewFlagSet(name: string, errorHandling: ErrorHandling) -> Ref<FlagSet>

/// Parse parses the command-line flags from [os.Args][1:]. Must be called
/// after all flags are defined and before flags are accessed by the program.
pub fn Parse()

/// Parsed reports whether the command-line flags have been parsed.
pub fn Parsed() -> bool

/// PrintDefaults prints, to standard error unless configured otherwise,
/// a usage message showing the default settings of all defined
/// command-line flags.
/// For an integer valued flag x, the default output has the form
/// 
/// 	-x int
/// 		usage-message-for-x (default 7)
/// 
/// The usage message will appear on a separate line for anything but
/// a bool flag with a one-byte name. For bool flags, the type is
/// omitted and if the flag name is one byte the usage message appears
/// on the same line. The parenthetical default is omitted if the
/// default is the zero value for the type. The listed type, here int,
/// can be changed by placing a back-quoted name in the flag's usage
/// string; the first such item in the message is taken to be a parameter
/// name to show in the message and the back quotes are stripped from
/// the message when displayed. For instance, given
/// 
/// 	flag.String("I", "", "search `directory` for include files")
/// 
/// the output will be
/// 
/// 	-I directory
/// 		search directory for include files.
/// 
/// To change the destination for flag messages, call [CommandLine].SetOutput.
pub fn PrintDefaults()

/// Set sets the value of the named command-line flag.
pub fn Set(name: string, value: string) -> Result<(), error>

/// String defines a string flag with specified name, default value, and usage string.
/// The return value is the address of a string variable that stores the value of the flag.
pub fn String(name: string, value: string, usage: string) -> Ref<string>

/// StringVar defines a string flag with specified name, default value, and usage string.
/// The argument p points to a string variable in which to store the value of the flag.
pub fn StringVar(p: Ref<string>, name: string, value: string, usage: string)

/// TextVar defines a flag with a specified name, default value, and usage string.
/// The argument p must be a pointer to a variable that will hold the value
/// of the flag, and p must implement encoding.TextUnmarshaler.
/// If the flag is used, the flag value will be passed to p's UnmarshalText method.
/// The type of the default value must be the same as the type of p.
pub fn TextVar(
  p: encoding.TextUnmarshaler,
  name: string,
  value: encoding.TextMarshaler,
  usage: string,
)

/// Uint defines a uint flag with specified name, default value, and usage string.
/// The return value is the address of a uint variable that stores the value of the flag.
pub fn Uint(name: string, value: uint, usage: string) -> Ref<uint>

/// Uint64 defines a uint64 flag with specified name, default value, and usage string.
/// The return value is the address of a uint64 variable that stores the value of the flag.
pub fn Uint64(name: string, value: uint64, usage: string) -> Ref<uint64>

/// Uint64Var defines a uint64 flag with specified name, default value, and usage string.
/// The argument p points to a uint64 variable in which to store the value of the flag.
pub fn Uint64Var(p: Ref<uint64>, name: string, value: uint64, usage: string)

/// UintVar defines a uint flag with specified name, default value, and usage string.
/// The argument p points to a uint variable in which to store the value of the flag.
pub fn UintVar(p: Ref<uint>, name: string, value: uint, usage: string)

/// UnquoteUsage extracts a back-quoted name from the usage
/// string for a flag and returns it and the un-quoted usage.
/// Given "a `name` to show" it returns ("name", "a name to show").
/// If there are no back quotes, the name is an educated guess of the
/// type of the flag's value, or the empty string if the flag is boolean.
pub fn UnquoteUsage(flag: Ref<Flag>) -> (string, string)

/// Var defines a flag with the specified name and usage string. The type and
/// value of the flag are represented by the first argument, of type [Value], which
/// typically holds a user-defined implementation of [Value]. For instance, the
/// caller could create a flag that turns a comma-separated string into a slice
/// of strings by giving the slice the methods of [Value]; in particular, [Set] would
/// decompose the comma-separated string into the slice.
pub fn Var(value: Value, name: string, usage: string)

/// Visit visits the command-line flags in lexicographical order, calling fn
/// for each. It visits only those flags that have been set.
pub fn Visit(fn_: fn(Ref<Flag>) -> ())

/// VisitAll visits the command-line flags in lexicographical order, calling
/// fn for each. It visits all flags, even those not set.
pub fn VisitAll(fn_: fn(Ref<Flag>) -> ())

/// A Flag represents the state of a flag.
pub struct Flag {
  pub Name: string,
  pub Usage: string,
  pub Value: Option<Value>,
  pub DefValue: string,
}

/// A FlagSet represents a set of defined flags. The zero value of a FlagSet
/// has no name and has [ContinueOnError] error handling.
/// 
/// [Flag] names must be unique within a FlagSet. An attempt to define a flag whose
/// name is already in use will cause a panic.
pub struct FlagSet {
  pub Usage: Option<fn() -> ()>,
}

/// Getter is an interface that allows the contents of a [Value] to be retrieved.
/// It wraps the [Value] interface, rather than being part of it, because it
/// appeared after Go 1 and its compatibility rules. All [Value] types provided
/// by this package satisfy the [Getter] interface, except the type used by [Func].
pub interface Getter {
  fn Get() -> Unknown
  fn Set(s: string) -> Result<(), error>
  fn String() -> string
}

/// Value is the interface to the dynamic value stored in a flag.
/// (The default value is represented as a string.)
/// 
/// If a Value has an IsBoolFlag() bool method returning true,
/// the command-line parser makes -name equivalent to -name=true
/// rather than using the next command-line argument.
/// 
/// Set is called once, in command line order, for each flag present.
/// The flag package may call the [String] method with a zero-valued receiver,
/// such as a nil pointer.
pub interface Value {
  fn Set(s: string) -> Result<(), error>
  fn String() -> string
}

pub var CommandLine: Ref<FlagSet>

/// ErrHelp is the error returned if the -help or -h flag is invoked
/// but no such flag is defined.
pub var ErrHelp: error

/// Usage prints a usage message documenting all defined command-line flags
/// to [CommandLine]'s output, which by default is [os.Stderr].
/// It is called when an error occurs while parsing flags.
/// The function is a variable that may be changed to point to a custom function.
/// By default it prints a simple header and calls [PrintDefaults]; for details about the
/// format of the output and how to control it, see the documentation for [PrintDefaults].
/// Custom usage functions may choose to exit the program; by default exiting
/// happens anyway as the command line's error handling strategy is set to
/// [ExitOnError].
pub var Usage: fn() -> ()

impl FlagSet {
  /// Arg returns the i'th argument. Arg(0) is the first remaining argument
  /// after flags have been processed. Arg returns an empty string if the
  /// requested element does not exist.
  fn Arg(self: Ref<FlagSet>, i: int) -> string

  /// Args returns the non-flag arguments.
  fn Args(self: Ref<FlagSet>) -> Slice<string>

  /// Bool defines a bool flag with specified name, default value, and usage string.
  /// The return value is the address of a bool variable that stores the value of the flag.
  fn Bool(self: Ref<FlagSet>, name: string, value: bool, usage: string) -> Ref<bool>

  /// BoolFunc defines a flag with the specified name and usage string without requiring values.
  /// Each time the flag is seen, fn is called with the value of the flag.
  /// If fn returns a non-nil error, it will be treated as a flag value parsing error.
  fn BoolFunc(
    self: Ref<FlagSet>,
    name: string,
    usage: string,
    fn_: fn(string) -> Result<(), error>,
  )

  /// BoolVar defines a bool flag with specified name, default value, and usage string.
  /// The argument p points to a bool variable in which to store the value of the flag.
  fn BoolVar(
    self: Ref<FlagSet>,
    p: Ref<bool>,
    name: string,
    value: bool,
    usage: string,
  )

  /// Duration defines a time.Duration flag with specified name, default value, and usage string.
  /// The return value is the address of a time.Duration variable that stores the value of the flag.
  /// The flag accepts a value acceptable to time.ParseDuration.
  fn Duration(
    self: Ref<FlagSet>,
    name: string,
    value: time.Duration,
    usage: string,
  ) -> Ref<time.Duration>

  /// DurationVar defines a time.Duration flag with specified name, default value, and usage string.
  /// The argument p points to a time.Duration variable in which to store the value of the flag.
  /// The flag accepts a value acceptable to time.ParseDuration.
  fn DurationVar(
    self: Ref<FlagSet>,
    p: Ref<time.Duration>,
    name: string,
    value: time.Duration,
    usage: string,
  )

  /// ErrorHandling returns the error handling behavior of the flag set.
  fn ErrorHandling(self: Ref<FlagSet>) -> ErrorHandling

  /// Float64 defines a float64 flag with specified name, default value, and usage string.
  /// The return value is the address of a float64 variable that stores the value of the flag.
  fn Float64(self: Ref<FlagSet>, name: string, value: float64, usage: string) -> Ref<float64>

  /// Float64Var defines a float64 flag with specified name, default value, and usage string.
  /// The argument p points to a float64 variable in which to store the value of the flag.
  fn Float64Var(
    self: Ref<FlagSet>,
    p: Ref<float64>,
    name: string,
    value: float64,
    usage: string,
  )

  /// Func defines a flag with the specified name and usage string.
  /// Each time the flag is seen, fn is called with the value of the flag.
  /// If fn returns a non-nil error, it will be treated as a flag value parsing error.
  fn Func(
    self: Ref<FlagSet>,
    name: string,
    usage: string,
    fn_: fn(string) -> Result<(), error>,
  )

  /// Init sets the name and error handling property for a flag set.
  /// By default, the zero [FlagSet] uses an empty name and the
  /// [ContinueOnError] error handling policy.
  fn Init(self: Ref<FlagSet>, name: string, errorHandling: ErrorHandling)

  /// Int defines an int flag with specified name, default value, and usage string.
  /// The return value is the address of an int variable that stores the value of the flag.
  fn Int(self: Ref<FlagSet>, name: string, value: int, usage: string) -> Ref<int>

  /// Int64 defines an int64 flag with specified name, default value, and usage string.
  /// The return value is the address of an int64 variable that stores the value of the flag.
  fn Int64(self: Ref<FlagSet>, name: string, value: int64, usage: string) -> Ref<int64>

  /// Int64Var defines an int64 flag with specified name, default value, and usage string.
  /// The argument p points to an int64 variable in which to store the value of the flag.
  fn Int64Var(
    self: Ref<FlagSet>,
    p: Ref<int64>,
    name: string,
    value: int64,
    usage: string,
  )

  /// IntVar defines an int flag with specified name, default value, and usage string.
  /// The argument p points to an int variable in which to store the value of the flag.
  fn IntVar(
    self: Ref<FlagSet>,
    p: Ref<int>,
    name: string,
    value: int,
    usage: string,
  )

  /// Lookup returns the [Flag] structure of the named flag, returning nil if none exists.
  fn Lookup(self: Ref<FlagSet>, name: string) -> Option<Ref<Flag>>

  /// NArg is the number of arguments remaining after flags have been processed.
  fn NArg(self: Ref<FlagSet>) -> int

  /// NFlag returns the number of flags that have been set.
  fn NFlag(self: Ref<FlagSet>) -> int

  /// Name returns the name of the flag set.
  fn Name(self: Ref<FlagSet>) -> string

  /// Output returns the destination for usage and error messages. [os.Stderr] is returned if
  /// output was not set or was set to nil.
  fn Output(self: Ref<FlagSet>) -> io.Writer

  /// Parse parses flag definitions from the argument list, which should not
  /// include the command name. Must be called after all flags in the [FlagSet]
  /// are defined and before flags are accessed by the program.
  /// The return value will be [ErrHelp] if -help or -h were set but not defined.
  fn Parse(self: Ref<FlagSet>, arguments: Slice<string>) -> Result<(), error>

  /// Parsed reports whether f.Parse has been called.
  fn Parsed(self: Ref<FlagSet>) -> bool

  /// PrintDefaults prints, to standard error unless configured otherwise, the
  /// default values of all defined command-line flags in the set. See the
  /// documentation for the global function PrintDefaults for more information.
  fn PrintDefaults(self: Ref<FlagSet>)

  /// Set sets the value of the named flag.
  fn Set(self: Ref<FlagSet>, name: string, value: string) -> Result<(), error>

  /// SetOutput sets the destination for usage and error messages.
  /// If output is nil, [os.Stderr] is used.
  fn SetOutput(self: Ref<FlagSet>, output: io.Writer)

  /// String defines a string flag with specified name, default value, and usage string.
  /// The return value is the address of a string variable that stores the value of the flag.
  fn String(self: Ref<FlagSet>, name: string, value: string, usage: string) -> Ref<string>

  /// StringVar defines a string flag with specified name, default value, and usage string.
  /// The argument p points to a string variable in which to store the value of the flag.
  fn StringVar(
    self: Ref<FlagSet>,
    p: Ref<string>,
    name: string,
    value: string,
    usage: string,
  )

  /// TextVar defines a flag with a specified name, default value, and usage string.
  /// The argument p must be a pointer to a variable that will hold the value
  /// of the flag, and p must implement encoding.TextUnmarshaler.
  /// If the flag is used, the flag value will be passed to p's UnmarshalText method.
  /// The type of the default value must be the same as the type of p.
  fn TextVar(
    self: Ref<FlagSet>,
    p: encoding.TextUnmarshaler,
    name: string,
    value: encoding.TextMarshaler,
    usage: string,
  )

  /// Uint defines a uint flag with specified name, default value, and usage string.
  /// The return value is the address of a uint variable that stores the value of the flag.
  fn Uint(self: Ref<FlagSet>, name: string, value: uint, usage: string) -> Ref<uint>

  /// Uint64 defines a uint64 flag with specified name, default value, and usage string.
  /// The return value is the address of a uint64 variable that stores the value of the flag.
  fn Uint64(self: Ref<FlagSet>, name: string, value: uint64, usage: string) -> Ref<uint64>

  /// Uint64Var defines a uint64 flag with specified name, default value, and usage string.
  /// The argument p points to a uint64 variable in which to store the value of the flag.
  fn Uint64Var(
    self: Ref<FlagSet>,
    p: Ref<uint64>,
    name: string,
    value: uint64,
    usage: string,
  )

  /// UintVar defines a uint flag with specified name, default value, and usage string.
  /// The argument p points to a uint variable in which to store the value of the flag.
  fn UintVar(
    self: Ref<FlagSet>,
    p: Ref<uint>,
    name: string,
    value: uint,
    usage: string,
  )

  /// Var defines a flag with the specified name and usage string. The type and
  /// value of the flag are represented by the first argument, of type [Value], which
  /// typically holds a user-defined implementation of [Value]. For instance, the
  /// caller could create a flag that turns a comma-separated string into a slice
  /// of strings by giving the slice the methods of [Value]; in particular, [Set] would
  /// decompose the comma-separated string into the slice.
  fn Var(self: Ref<FlagSet>, value: Value, name: string, usage: string)

  /// Visit visits the flags in lexicographical order, calling fn for each.
  /// It visits only those flags that have been set.
  fn Visit(self: Ref<FlagSet>, fn_: fn(Ref<Flag>) -> ())

  /// VisitAll visits the flags in lexicographical order, calling fn for each.
  /// It visits all flags, even those not set.
  fn VisitAll(self: Ref<FlagSet>, fn_: fn(Ref<Flag>) -> ())
}
