-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add alias support and update help func output to include it. (#23)
* update help command string output and add alias support * update readme to remove aliases from todo
- Loading branch information
1 parent
39bfd29
commit 21faf5d
Showing
5 changed files
with
74 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
from memory._arc import Arc | ||
from prism import Flag, Command, CommandArc | ||
from prism.vector import to_string | ||
|
||
|
||
fn test(command: CommandArc, args: List[String]) -> None: | ||
print("Pass tool, object, or thing as a subcommand!") | ||
|
||
|
||
fn tool_func(command: CommandArc, args: List[String]) -> None: | ||
print("My tool!") | ||
|
||
|
||
fn init() -> None: | ||
var root_command = Command( | ||
name="my", | ||
description="This is a dummy command!", | ||
run=test, | ||
) | ||
|
||
var tool_command = Command( | ||
name="tool", description="This is a dummy command!", run=tool_func, aliases=List[String]("object", "thing") | ||
) | ||
|
||
root_command.add_command(tool_command) | ||
root_command.execute() | ||
|
||
|
||
fn main() -> None: | ||
init() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters