Skip to content

wynlang/args

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

args - Official Wyn Package

CLI argument parser. Pure Wyn.

Install

wyn pkg install github.com/wynlang/args

Usage

import args

// Reads the real process arguments (System.args()):
var verbose = args.flag("--verbose")   // bool
var port = args.value("--port")        // string, "" if absent

Public API:

  • flag(name) -> bool — is name present on the command line?
  • value(name) -> string — the token after name, or "".
  • flag_in(argv_str, name) / value_in(argv_str, name) — the pure, testable core over a space-delimited argv string (Wyn arrays can't cross a module boundary, so the public surface takes strings).
  • argv_string() -> stringSystem.args() joined by spaces.

Note: System.args() only carries CLI arguments in a built binary (wyn build app.wyn then ./app --flag); it is not populated when a script is launched via wyn run.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors