Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use system.program-name. #50

Merged
merged 2 commits into from
Jan 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ jobs:
os: [ ubuntu-latest, windows-latest, macos-latest ]
# The versions should contain (at least) the lowest requirement
# and a version that is more up to date.
toit-version: [ v2.0.0-alpha.120, latest ]
toit-version: [ v2.0.0-alpha.128, latest ]
include:
- toit-version: v2.0.0-alpha.120
- toit-version: v2.0.0-alpha.128
version-name: old
- toit-version: latest
version-name: new
Expand Down
2 changes: 1 addition & 1 deletion package.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: cli
description: Tools, like an argument parser, to create command-line applications.
environment:
sdk: ^2.0.0-alpha.120
sdk: ^2.0.0-alpha.128
dependencies:
fs:
url: github.com/toitlang/pkg-fs
Expand Down
11 changes: 6 additions & 5 deletions src/cli.toit
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
// found in the package's LICENSE file.

import uuid
import system

import .cache
import .config
Expand Down Expand Up @@ -182,13 +183,13 @@ class Command:
subcommands_.add command

/** Returns the help string of this command. */
help --invoked-command/string=program-name -> string:
help --invoked-command/string=system.program-name -> string:
generator := HelpGenerator [this] --invoked-command=invoked-command
generator.build-all
return generator.to-string

/** Returns the usage string of this command. */
usage --invoked-command/string=program-name -> string:
usage --invoked-command/string=system.program-name -> string:
generator := HelpGenerator [this] --invoked-command=invoked-command
generator.build-usage --as-section=false
return generator.to-string
Expand All @@ -200,7 +201,7 @@ class Command:
with the $Parsed output.

The $invoked-command is used only for the usage message in case of an
error. It defaults to $program-name.
error. It defaults to $system.program-name.

If no UI is given, the arguments are parsed for `--verbose`, `--verbosity-level` and
`--output-format` to create the appropriate UI object. If a $ui is given, then these
Expand All @@ -209,7 +210,7 @@ class Command:
The $add-ui-help flag is used to determine whether to include help for `--verbose`, ...
in the help output. By default it is active if no $ui is provided.
*/
run arguments/List --invoked-command=program-name --ui/Ui?=null --add-ui-help/bool=(not ui) -> none:
run arguments/List --invoked-command=system.program-name --ui/Ui?=null --add-ui-help/bool=(not ui) -> none:
if not ui: ui = create-ui-from-args_ arguments
if add-ui-help:
add-ui-options_
Expand Down Expand Up @@ -258,7 +259,7 @@ class Command:
/**
Checks this command and all subcommands for errors.
*/
check --invoked-command=program-name:
check --invoked-command=system.program-name:
check_ --path=[invoked-command]

are-prefix-of-each-other_ str1/string str2/string -> bool:
Expand Down