Help us shape the future of Go! Take the 2026 Go Developer Survey

cli

package
v0.5.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 29, 2026 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Overview

Package cli holds what the two command lines, innerwall and innerwall-agent, share in reading their arguments.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Leading

func Leading(fs *flag.FlagSet, args []string) (names, rest []string)

Leading reports how fs.Parse alone would read args: the names of the flags it would read, those before the first positional argument or `--`, and every argument from that positional on, `--` itself left out. It reads nothing into fs. A command whose earlier versions ignored some arguments uses it to refuse them rather than read them differently.

func Parse

func Parse(fs *flag.FlagSet, args []string, maxPositional int) error

Parse reads args into fs as fs.Parse does, except that flags may also follow the command's positional arguments: `flows list <workload-id> --since 1h` reads as `flows list --since 1h <workload-id>`.

maxPositional is the most positional arguments the command takes. Flags are read around up to that many; a positional past them ends flag parsing as fs.Parse does, so it and everything after it stay positional for the command's own count to refuse. A command that takes none passes 0 and parses exactly as fs.Parse would. `--` ends flag parsing wherever it appears, and a flag that takes a value takes the next argument whatever its shape, both as in fs.Parse.

A command whose count refuses extra positionals therefore reads every invocation fs.Parse accepted the same way: under fs.Parse a flag after a positional was itself a positional, and over the count.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL