args

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Jun 22, 2026 License: MIT Imports: 8 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package args provides an argparse-style command-line argument parser for Starlark scripts run by starcli. The surface deliberately mirrors Python's argparse so it reads familiarly:

load("args", "ArgumentParser")
p = ArgumentParser(description = "greet someone")
p.add_argument("--name", default = "World", help = "who to greet")
p.add_argument("--count", type = int, default = 1)
p.add_argument("--shout", action = "store_true")
p.add_argument("file", help = "input file")
ns = p.parse_args()            # parses the script's args (argv[1:])
print(ns.name, ns.count, ns.shout, ns.file)

args.argv is the full argument vector (argv[0] is the script name or "-c", like Python's sys.argv); parse_args defaults to argv[1:].

Index

Constants

View Source
const ModuleName = "args"

ModuleName defines the module name.

Variables

This section is empty.

Functions

func NewModule

func NewModule(argv []string) starlet.ModuleLoader

NewModule creates the args module loader, capturing the script argv.

Types

This section is empty.

Jump to

Keyboard shortcuts

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