forked from amber-lang/amber
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Shell variable interaction (amber-lang#276)
* Shell variable interaction * remove amber_test println * return type Bool now shelle_var_set and shell_unset return true or false * Update src/std/main.ab Co-authored-by: Phoenix Himself <[email protected]> * Update src/std/main.ab Co-authored-by: Phoenix Himself <[email protected]> * Update src/std/main.ab Co-authored-by: Phoenix Himself <[email protected]> * Update src/std/main.ab Co-authored-by: Phoenix Himself <[email protected]> * Update src/std/main.ab Co-authored-by: Phoenix Himself <[email protected]> * add shell_constant_get test * define set/get/unset shell_var function as faillabe --------- Co-authored-by: Phoenix Himself <[email protected]>
- Loading branch information
1 parent
4ec4486
commit 2b96f87
Showing
13 changed files
with
76 additions
and
0 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
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,5 @@ | ||
import * from "std" | ||
main { | ||
unsafe shell_constant_set("test_shell_constant_get", "Hello Amber!") | ||
unsafe $echo "\$test_shell_constant_get"$ | ||
} |
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 @@ | ||
Hello Amber! |
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,10 @@ | ||
import * from "std" | ||
main { | ||
unsafe shell_constant_set("test_shell_constant_set", "Hello Amber") | ||
let str = "" | ||
str += unsafe $echo "\$test_shell_constant_set"$ | ||
shell_constant_set("test_shell_constant_set", "Hello Amber") failed { | ||
str += " Shell Constant!" | ||
} | ||
echo str | ||
} |
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 @@ | ||
Hello Amber Shell Constant! |
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,11 @@ | ||
import * from "std" | ||
main { | ||
unsafe $test_var_isset="test"$ | ||
if shell_isset("test_var_isset") { | ||
echo "test_var_isset" | ||
} | ||
|
||
if shell_isset("test_var_isset2") { | ||
echo "test_var_isset2" | ||
} | ||
} |
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 @@ | ||
test_var_isset |
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,7 @@ | ||
import * from "std" | ||
main { | ||
unsafe shell_var_set("test_shell_unset", "Hello Amber!") | ||
unsafe $echo \$test_shell_unset$ | ||
unsafe shell_unset("test_shell_unset") | ||
unsafe $echo \$test_shell_unset$ | ||
} |
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 @@ | ||
Hello Amber! |
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,5 @@ | ||
import * from "std" | ||
main { | ||
unsafe $declare -g test_shell_var_get="Hello Amber!"$ | ||
echo unsafe shell_var_get("test_shell_var_get") | ||
} |
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 @@ | ||
Hello Amber! |
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,5 @@ | ||
import * from "std" | ||
main { | ||
unsafe shell_var_set("test_shell_var_set", "Hello Amber!") | ||
unsafe $echo \$test_shell_var_set$ | ||
} |
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 @@ | ||
Hello Amber! |