ion issueshttps://gitlab.redox-os.org/redox-os/ion/-/issues2021-06-01T13:57:01Zhttps://gitlab.redox-os.org/redox-os/ion/-/issues/705Add `type`-builtin instead of `which`2021-06-01T13:57:01ZMichael Aaron Murphymmstick@pm.meAdd `type`-builtin instead of `which`*Created by: LeonardKoenig*
**Description**: `which` is a remnant of csh and behaves on many shells differently, `type` has since replaced it as a portable and standardized alternative, cf. https://unix.stackexchange.com/questions/85249...*Created by: LeonardKoenig*
**Description**: `which` is a remnant of csh and behaves on many shells differently, `type` has since replaced it as a portable and standardized alternative, cf. https://unix.stackexchange.com/questions/85249/why-not-use-which-what-to-use-then
**Proposed change**: Add `type` shell-builtin, possibly deprecate/remove `which`.Ion 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/506dmenu doesn't work as expected2018-07-01T17:59:19ZMichael Aaron Murphymmstick@pm.medmenu doesn't work as expected*Created by: bb010g*
**Reproduction**:
Run the following script with no arguments and press enter when prompted:
```
#!/usr/bin/env ion
echo $join(@args[1..], "|")
let foo = $(dmenu @args[1..])
let foo = $(echo hi | dmenu @arg...*Created by: bb010g*
**Reproduction**:
Run the following script with no arguments and press enter when prompted:
```
#!/usr/bin/env ion
echo $join(@args[1..], "|")
let foo = $(dmenu @args[1..])
let foo = $(echo hi | dmenu @args[1..])
echo got foo
ion -c "echo "$foo | /usr/bin/cat
ion -c "echo "$foo | dmenu @args[1..]
echo $foo | dmenu @args[1..]
```
**Expected behavior**:
I'd expect it to work equivalently to this dash script:
```
#!/usr/bin/env dash
(IFS="|"; echo "$*")
foo="`dmenu "$@"`"
foo="`echo hi | dmenu "$@"`"
echo got foo
dash -c "echo "$foo | /usr/bin/cat
dash -c "echo "$foo | dmenu "$@"
echo $foo | dmenu "$@"
```
The output will first be a blank line followed by execution stopping as dmenu waits for input. Enter a line and press `^D` to make it prompt you and keep going. `foo` will get `hi` assigned to it. `got foo` will be printed, followed by `hi` three times.
**Actual behavior**:
Ion will cause dmenu to show up with no choices. Type `bar`, press enter, and Ion presents a proper dmenu with `hi` as the choice. `got foo` and `hi` will be printed, followed by:
```
usage: dmenu [-bfiv] [-l lines] [-p prompt] [-fn font] [-m monitor]
[-nb color] [-nf color] [-sb color] [-sf color] [-w windowid]
usage: dmenu [-bfiv] [-l lines] [-p prompt] [-fn font] [-m monitor]
[-nb color] [-nf color] [-sb color] [-sf color] [-w windowid]
```
The script exits with 1.
**Build information**: [output of `rustc -V`, `git rev-parse HEAD`, `qemu-i386 -version`, `uname -a`, etc.]
```
rustc 1.19.0 (0ade33941 2017-07-17)
HEAD: 3319ffb00e3ff54db1446302a7debd7e7f7ff893
Linux bb010g-lat 4.12.8-1-ARCH #1 SMP PREEMPT Thu Aug 17 08:37:20 CEST 2017 x86_64 GNU/Linux
dmenu -v: dmenu-4.7
```
**Blocking/related**: Maybe #424? I'm not sure here.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/418prompt: Syntax Highlighting in Prompt2021-06-01T12:33:57ZMichael Aaron Murphymmstick@pm.meprompt: Syntax Highlighting in PromptWill require some seirous modifications to [liner](https://github.com/MovingtoMars/liner) in order to get this to work. I'm insure of the best approach for implementing this feature at the moment. Regex or a parsing crate may be ideal. S...Will require some seirous modifications to [liner](https://github.com/MovingtoMars/liner) in order to get this to work. I'm insure of the best approach for implementing this feature at the moment. Regex or a parsing crate may be ideal. Solution needs to focus on performance though. The following needs to occur:
- [ ] Color the command based on if the command exists or not
- [ ] Single quoted text should have a different color from double quoted text
- [ ] Operators should have their own unique colors
- [ ] Specific keywords should be highlighted, such as `end` and `if`
- [ ] Variables should also be highlighted
- [ ] Arrays should have a different color than variables
- [ ] Functions and aliases may also have different colors
- [ ] The coloring should be user-configurable and ideally match the grammar usage (in treesitter)Ion Shell v1.0.0Sag0Sag0Sag0Sag0https://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/397shellac: Application-Specific Tab Completions2021-06-01T11:05:12ZMichael Aaron Murphymmstick@pm.meshellac: Application-Specific Tab Completions*Created by: xTibor*
The `sudo` command should have command completions. At the moment the tab completions suggests files and directories for this command.
**Build information**:
`git rev-parse HEAD`: eb13ba645bad3b311843f38f84455ce3a5...*Created by: xTibor*
The `sudo` command should have command completions. At the moment the tab completions suggests files and directories for this command.
**Build information**:
`git rev-parse HEAD`: eb13ba645bad3b311843f38f84455ce3a53fdb8d
`rustc -V`: rustc 1.20.0-nightly (720c596ec 2017-07-08)Ion Shell v1.0.0BafDyceBafDycehttps://gitlab.redox-os.org/redox-os/ion/-/issues/247Implement `mapfile` as builtin2021-06-01T10:54:12ZMichael Aaron Murphymmstick@pm.meImplement `mapfile` as builtinUnlike associated arrays, these should be stored in vectors, and empty lines should be skipped.
See here how it works: https://origin.geeksforgeeks.org/mapfile-command-in-linux-with-examples/Unlike associated arrays, these should be stored in vectors, and empty lines should be skipped.
See here how it works: https://origin.geeksforgeeks.org/mapfile-command-in-linux-with-examples/Ion Shell v1.0.0https://gitlab.redox-os.org/redox-os/ion/-/issues/195Add Syntax Highlighting Support for ion2021-06-01T10:51:43ZMichael Aaron Murphymmstick@pm.meAdd Syntax Highlighting Support for ionThe editor-independent solution to go for is treesitter.
While the script sizes will not require incremental parsing, treesitter is a C program and thus widely portable and supported.
The bits that are missing so far are only making fu...The editor-independent solution to go for is treesitter.
While the script sizes will not require incremental parsing, treesitter is a C program and thus widely portable and supported.
The bits that are missing so far are only making functions with arguments and references work.
`amend` will not be part of ion, because globally mutable state is very, very bad and easily to mess up things (besides making ion slower).Ion Shell v1.0.0