ion issueshttps://gitlab.redox-os.org/redox-os/ion/-/issues2020-12-12T21:56:29Zhttps://gitlab.redox-os.org/redox-os/ion/-/issues/991Simplify slicing2020-12-12T21:56:29Zmatu3baSimplify slicingfeat: Remove edge cases
BREAKING CHANGE: progams relying on slicing MUST be revalidated
perf: impact
performance none
usability increase
maintainability increase
code: input
```sh
let array = [{1..10}]
let array2 = [{1...10}]
echo...feat: Remove edge cases
BREAKING CHANGE: progams relying on slicing MUST be revalidated
perf: impact
performance none
usability increase
maintainability increase
code: input
```sh
let array = [{1..10}]
let array2 = [{1...10}]
echo @array
echo @array2
```
expect: output
```
1 2 3 4 5 6 7 8 9 10
1 2 3 4 5 6 7 8 9 10
```
actual: output
```
1 2 3 4 5 6 7 8 9
1 2 3 4 5 6 7 8 9 10
```
reason: better usability and remove edge case
context: We should reuse the inclusive annotation for slicing to simplify working with the shell.
```
let array2 = [{1..=10}]
```Ion Shell v1.0.0betahttps://gitlab.redox-os.org/redox-os/ion/-/issues/944Dynamic Configuration2021-01-08T16:43:43ZNathaniel Barragancontact@nathanielbarragan.xyzDynamic ConfigurationI do notice that the configuration of this shell dynamically (After compilation) is lacking. Perhaps we can add some builtins for configuration, OR make environment variables change different configurations? For example, turning implicit...I do notice that the configuration of this shell dynamically (After compilation) is lacking. Perhaps we can add some builtins for configuration, OR make environment variables change different configurations? For example, turning implicit cd off could be done by setting the environment variable `ION_IMPLICIT_CD=false`?
I suppose this is more of an RFC as opposed to an actual issue?unplannedhttps://gitlab.redox-os.org/redox-os/ion/-/issues/866Arbitrary character for array expansion2020-12-12T23:04:37ZAdminXVIIArbitrary character for array expansionThe `@split($(command) "\n")` syntax is too verbose for expansion, and is quite common.
It would be better if Ion had a shorthand notation.
~~Proposition: `@"\n"(command)`, where "\n" can be any arbitrary separator.~~
This could cause c...The `@split($(command) "\n")` syntax is too verbose for expansion, and is quite common.
It would be better if Ion had a shorthand notation.
~~Proposition: `@"\n"(command)`, where "\n" can be any arbitrary separator.~~
This could cause confusion with methods, where `@join(command)` and `@"join"(command)` behave fairly differently. Further more, this would not allow expansion and/or would make it awkward (ex: `@"$var"(command)`)unplannedhttps://gitlab.redox-os.org/redox-os/ion/-/issues/779Tracking Issue: Supported Types For Type-Checking2021-06-01T12:00:24ZMichael Aaron Murphymmstick@pm.meTracking Issue: Supported Types For Type-CheckingWe should evaluate and expand upon our current set of supported types. Here's a basic set of what we could support:
- **[T]**: an array of like-values
- **str**: a string -- the default type
- **bool**: either `1` or `0`
- **float**: a ...We should evaluate and expand upon our current set of supported types. Here's a basic set of what we could support:
- **[T]**: an array of like-values
- **str**: a string -- the default type
- **bool**: either `1` or `0`
- **float**: a generic decimal of any size
- **int**: a generic integer of any size, which may be negative
- **i32**: 32-bit int
- **i64**: 64-bit int
- **i128**: 128-bit int
- **uint**: a generic integer of any size, which may not be negative
- **u32**: 32-bit uint
- **u64**: 64-bit uint
- **u128**: 128-bit uintIon Shell v1.0.0https://gitlab.redox-os.org/redox-os/ion/-/issues/508Ideas on Plugins and Security2021-06-01T11:37:18ZMichael Aaron Murphymmstick@pm.meIdeas on Plugins and SecurityWe should probably have a `ION_PLUGINS_ENABLED` variable that is set to 1 by default, but can be set to 0 to disable support for plugins. In addition, maybe we could also implement an optional `ION_PLUGINS_METHOD_WHITELIST` and `ION_PLUG...We should probably have a `ION_PLUGINS_ENABLED` variable that is set to 1 by default, but can be set to 0 to disable support for plugins. In addition, maybe we could also implement an optional `ION_PLUGINS_METHOD_WHITELIST` and `ION_PLUGINS_NAMESPACE_WHITELIST` array which can be used to designate plugins that are explicitly allowed to execute. Then maybe we could have a means of protecting certain variables from being set within scripts, or even only allowing certain variables to be set from an environment file. Suggestions welcome for ways to make Ion more secure.Ion Shell v1.0.0https://gitlab.redox-os.org/redox-os/ion/-/issues/441Tracking Issue: List of Methods in Ion2021-06-01T11:15:56ZMichael Aaron Murphymmstick@pm.meTracking Issue: List of Methods in Ion# String Methods
String methods return strings
- [x] $len(string) -> n string
- [x] $len(array) -> n string (@mmstick)
- [x] $len_bytes(string) -> n string
- [x] $join(array) -> string
- [x] $find(string, string) -> n string
- [x] $sta...# String Methods
String methods return strings
- [x] $len(string) -> n string
- [x] $len(array) -> n string (@mmstick)
- [x] $len_bytes(string) -> n string
- [x] $join(array) -> string
- [x] $find(string, string) -> n string
- [x] $starts_with(string, string) -> 0/1 string (@mmstick)
- [x] $ends_with(string, string) -> 0/1 string (@mmstick)
- [x] $contains(string, string) -> 0/1 string (@mmstick)
- [x] $replace(string, string) -> string (@mmstick)
- [x] $replacen(string, string) -> string (@mmstick)
- [x] $to_lowercase(string) -> string (@pithonsmear)
- [x] $to_uppercase(string) -> string (@pithonsmear)
- [x] $repeat(string, n) -> string (@mmstick)
- [x] $extension(filepath) -> string (@pithonsmear)
- [x] $basename(filepath) -> string (@pithonsmear)
- [x] $parent(filepath) -> string (@pithonsmear)
- [x] $filename(filepath) -> string (@pithonsmear)
- [ ] $or(string, expr) -> string
- If the given string does not exist, use the given expression
- [x] $reverse(string) -> string (@pithonsmear)
- [ ] $fold(array, string) -> string
- Apply a reduce/fold function to an array
- The supplied string should name a command to apply to the array
- [ ] $open(string) -> string
- Open a file and buffer the entire file into memory
- [x] $regex_replace(string, string)
- Same as $replace(), but the pattern is a regex expression
# Array Methods
Array methods return arrays
- [x] @split(string, opt<string>) -> array
- [x] @bytes(string) -> array
- [x] @chars(string) -> array
- [x] @graphemes(string) -> array
- [x] @reverse(array) -> array
- [x] @lines(string) -> array
- Split a given string by newlines
- [ ] @filter(array, string) -> array
- Apply a filter command to each element in the array
- Exit status determines which values to filter
- `@filter(array, x => matches $x '([F])\w+')`
- [ ] @map(array, string) -> array
- Apply a command to each element in the array
- Output of the command is the new value for that index
- `@map(array, x => calc $x + $x)`
- [ ] @open(array, opt<string>) -> array
- If no pattern string is supplied, split the file by newlines
- [x] @split_at(string, n) -> [string, string]
- Splits a string into a two-element array; Rust's std
- [ ] @split_args(string)
- Provides an interface for the `ArgumentSplitter` functionality in the shell.Ion Shell v1.0.0https://gitlab.redox-os.org/redox-os/ion/-/issues/409Tracking Issue: List of Builtins to Implement2021-06-01T11:16:08ZMichael Aaron Murphymmstick@pm.meTracking Issue: List of Builtins to ImplementIf you have an idea for a builtin which is not on this list, discuss it below.
# Conditional Builtins
- [x] `true`: Simply returns a `SUCCESS` status
- [x] `false`: Simply returns a `FAILED` status
- [x] `not <command>`: Reverses the ex...If you have an idea for a builtin which is not on this list, discuss it below.
# Conditional Builtins
- [x] `true`: Simply returns a `SUCCESS` status
- [x] `false`: Simply returns a `FAILED` status
- [x] `not <command>`: Reverses the exit status value of the given command. (@drosseau)
- [x] `contains $key @values`: Returns 0 exit status if the key is contained within the values.
- [x] `starts-with $key @values`
- [x] `ends-with $key @values`
- [x] `matches $key $regex`: A regex-based evaluator
- [ ] `isatty [FD]`: Returns 0 exit status if the supplied FD is a tty
- [x] `and <command>`: Execute the command only if the shell's previous status is 0
- `true; and echo true`
- [x] `or <command>`: The reverse of `and`.
- `false; or echo false`
- [x] `exists -b BINARY`: Returns 0 exit status if the binary is in PATH
- [x] `exists -f PATH`: Returns 0 exit status if the path is a file
- [x] `exists -d PATH`: Returns 0 exit status if the path is a directory
- [x] `exists -s STRING`: Returns 0 exit status if the string var is not empty
- [x] `exists -a ARRAY`: Returns 0 exit status if the array var is not empty
- [x] `exists STRING`: Returns 0 exit status if the string is not empty
- [ ] `is $var $value`: Returns 0 exit status if both arguments are the same
- [ ] `is not $var $value`: The opposite of the above
- [ ] `bool $value`: If the value is "1" or "true", return 0 exit status
- [ ] < (Polish Notation)
- [ ] <= (Polish Notation)
- [ ] > (Polish Notation)
- [ ] >= (Polish Notation)
- [ ] = (Polish Notation)
# Job Control
- [x] `jobs`: Lists available background jobs
- [x] `bg`: Sends **SIGCONT** to a given background job
- [x] `fg`: Does the same as `bg`, but also brings it to the foreground via `tcsetpgrp`
- [x] `wait`: waits until background jobs have finished
- [x] `exit`: waits until background jobs have finished, and exits
- [x] `suspend`: suspends the shell via a `SIGTSTOP`
# Misc
- [x] `ion-docs`: Opens the locally-installed Ion documentation in a web browser
- [x] `which`: Prints the kind and/or path of the given command
# Math & Crypto
- [x] `calc`: built-in calculator that will eventually be arbitrary precision
- [ ] `random`: generate random numbers
# I/O
- [x] `echo`: Prints the evaluated expression to standard output
- [x] `read`: Stores the next line of input to standard input into a specified variable
- [ ] `printf`: Implement the same as other shells
- [ ] `printr`: Rusty variant maybe?
- [ ] `cat`: Perhaps copy `cat` from coreutils into Ion.
# Command Execution
- [x] `eval`: Evaluates and executes the evaluated expression
- [x] `time`: Prints timing statistics once it's job has finished
- [ ] `exec`: Replace the shell process with the specified command
# Possible Builtins From POSIX Shells
- [ ] `command -v`: often used to determine if a binary exists in a PATHIon Shell v1.0.0https://gitlab.redox-os.org/redox-os/ion/-/issues/336Builtin: Array Arithmetic Expressions2021-06-01T11:04:02ZMichael Aaron Murphymmstick@pm.meBuiltin: Array Arithmetic ExpressionsNow that we have support for string-based arithmetic, perhaps we might want to also implement array-based arithmetic? This issue will discuss possible syntax ideas that we could pursue.
# Proposal # 1
This approach is commonly used in ...Now that we have support for string-based arithmetic, perhaps we might want to also implement array-based arithmetic? This issue will discuss possible syntax ideas that we could pursue.
# Proposal # 1
This approach is commonly used in functional languages, so it might also be a natural fit here. Define a variable name to describe each element in the array, and then follow it with a mathematical expression to apply with each element in the array.
```ion
@[ELEMENT -> EXPR, ARRAY EXPR]
```
## Examples
### Example # 1
```ion
let array = [1 2 3]
for result in @[x -> x * x, array]
echo $result
end
```
### Output # 1
```ion
1
4
9
```
### Example # 2
```ion
let array = [1 2 3]
let value = 3
for result in @[x -> x * value, array]
echo $result
end
```
### Output # 2
```ion
3
6
9
```unplanned