-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make CLI arguments accessible in zxpy programs (#52)
* Fix sys.argv passed to tests * Improve test assertion * Add $ arg support * Normalize /bin/sh as first argument of script_args * Add type def
- Loading branch information
1 parent
0d999ad
commit 5b0db6b
Showing
4 changed files
with
147 additions
and
5 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,8 @@ | ||
import sys | ||
|
||
assert len(sys.argv) == 1 | ||
assert sys.argv[0].endswith("argv.py") | ||
assert len(sys.argv) == 3 | ||
assert sys.argv[1] == "foobar" | ||
assert sys.argv[2] == "baz" | ||
|
||
out = ~"echo $1 and $2" | ||
assert out == "foobar and baz\n" |
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,6 @@ | ||
x = ~"uname -p" | ||
print(x in ("arm\n", "x86_64\n")) | ||
|
||
command = "uname -p" | ||
_, _, rc = ~f"{command}" # This doesn't work | ||
print(rc) |
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