ion issueshttps://gitlab.redox-os.org/redox-os/ion/-/issues2018-08-22T19:14:19Zhttps://gitlab.redox-os.org/redox-os/ion/-/issues/795Optional Assignment Operator2018-08-22T19:14:19ZMichael Aaron Murphymmstick@pm.meOptional Assignment OperatorIt can be useful to optionally-define a variable if it has not been set, as is often seen in Make files.
```sh
let FOO ?= BAR
# FOO is now BAR
let FOO ?= BAZZ
# FOO is still BAR
```
Should make the following possible:
```sh
$ env OPT=...It can be useful to optionally-define a variable if it has not been set, as is often seen in Make files.
```sh
let FOO ?= BAR
# FOO is now BAR
let FOO ?= BAZZ
# FOO is still BAR
```
Should make the following possible:
```sh
$ env OPT=FOO ./script.ion
OPT is FOO
$ ./script.ion
OPT is BAR
```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/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/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/771Document default values and variables2020-12-06T17:01:50ZMichael Aaron Murphymmstick@pm.meDocument default values and variables* [x] `[ no_such_command whitespace duplicates ]`.
* [x] Make sure duplicates is mentioned in the manual
* [ ] Make sure all default values & variables are documented as well* [x] `[ no_such_command whitespace duplicates ]`.
* [x] Make sure duplicates is mentioned in the manual
* [ ] Make sure all default values & variables are documented as wellIon Shell v1.0.0https://gitlab.redox-os.org/redox-os/ion/-/issues/457Implement Step By Ranges2019-04-02T15:43:30ZMichael Aaron Murphymmstick@pm.meImplement Step By RangesWe have inclusive ranges, and exclusive ranges, so now we need a means of specifying an optional stepping.
```ion
$ let array = 1 2 3 4 5 6 7 8 9 10
$ echo @array[0,2..10]
> 1 3 5 7 9
$ echo {0,3..10}
> 0 3 6 9
```We have inclusive ranges, and exclusive ranges, so now we need a means of specifying an optional stepping.
```ion
$ let array = 1 2 3 4 5 6 7 8 9 10
$ echo @array[0,2..10]
> 1 3 5 7 9
$ echo {0,3..10}
> 0 3 6 9
```Ion Shell v1.0.0https://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/542calc builtin conflicts with commonly-used tool2019-07-22T21:13:58ZMichael Aaron Murphymmstick@pm.mecalc builtin conflicts with commonly-used tool*Created by: jbg*
**Reproduction**: Run `calc`
**Expected behavior**: The common "C-style arbitrary precision calculator" ([website](http://www.isthe.com/chongo/tech/comp/calc/)), distributed as a part of *NIX distributions since 199...*Created by: jbg*
**Reproduction**: Run `calc`
**Expected behavior**: The common "C-style arbitrary precision calculator" ([website](http://www.isthe.com/chongo/tech/comp/calc/)), distributed as a part of *NIX distributions since 1994, launches.
**Actual behavior**: Apparently my shell is hung, but in fact the shell builtin is waiting for input and does not respond to Ctrl-C.
Maybe I'm one of the last people still using the fantastic `calc` calculator, but I hope not. Please consider renaming your builtin, or if not, at least make it respond to Ctrl-C :)Ion Shell v1.0.0https://gitlab.redox-os.org/redox-os/ion/-/issues/416Better Builtin Help Documentation2020-04-22T01:00:30ZMichael Aaron Murphymmstick@pm.meBetter Builtin Help DocumentationCurrently, builtins have very basic one-line short descriptions, but what we need is to provide a complete manpage when help for a specific command is asked for.Currently, builtins have very basic one-line short descriptions, but what we need is to provide a complete manpage when help for a specific command is asked for.Ion Shell v1.0.0https://gitlab.redox-os.org/redox-os/ion/-/issues/494support CDPATH2019-03-23T17:46:26ZMichael Aaron Murphymmstick@pm.mesupport CDPATH*Created by: aeosynth*
> The search path for the `cd` command. This is a colon-separated list of directories in which the shell looks for destination directories specified by the `cd` command. A sample value is ".:~:/usr".
as seen in...*Created by: aeosynth*
> The search path for the `cd` command. This is a colon-separated list of directories in which the shell looks for destination directories specified by the `cd` command. A sample value is ".:~:/usr".
as seen in bash, zsh, fish...Ion Shell v1.0.0https://gitlab.redox-os.org/redox-os/ion/-/issues/776Disallow Repeated Assignment Keys2018-08-10T01:25:54ZMichael Aaron Murphymmstick@pm.meDisallow Repeated Assignment KeysThis should not be allowed:
```
let x x = 1 2
```
Nor should this:
```
fn func x x
```
In both cases, an error should be printed, and an exit status of 1 provided.This should not be allowed:
```
let x x = 1 2
```
Nor should this:
```
fn func x x
```
In both cases, an error should be printed, and an exit status of 1 provided.Ion Shell v1.0.0Roland KovácsRoland Kovácshttps://gitlab.redox-os.org/redox-os/ion/-/issues/777Array Index Range Assignment2021-06-01T13:04:51ZMichael Aaron Murphymmstick@pm.meArray Index Range AssignmentAs per the Ion specification:
### Array Index Range Assignment
[array-index-range-assignment]: #array-index-range-assignment
It is also possible to assign an array to replace a range of values. The array being assigned to
that region m...As per the Ion specification:
### Array Index Range Assignment
[array-index-range-assignment]: #array-index-range-assignment
It is also possible to assign an array to replace a range of values. The array being assigned to
that region may be smaller or larger than the region it is replacing.
```
$ let FOO = [1 2 3 4]
$ let FOO[..1] = [4 5 6]
$ let FOO[2..3] = [7]
$ echo @FOO
4 5 6 7
```Ion Shell v1.0.0stratactstratact1@gmail.comstratactstratact1@gmail.comhttps://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/788Associative Array Insertions2018-07-02T16:26:04ZMichael Aaron Murphymmstick@pm.meAssociative Array InsertionsAssociative arrays should allow inserting new keys.
```
let map[new_key] = value
```Associative arrays should allow inserting new keys.
```
let map[new_key] = value
```Ion Shell v1.0.0stratactstratact1@gmail.comstratactstratact1@gmail.comhttps://gitlab.redox-os.org/redox-os/ion/-/issues/789BTree-based Associative Arrays2018-07-03T16:05:06ZMichael Aaron Murphymmstick@pm.meBTree-based Associative ArraysShould act identically to the existing HashMap-based associative array.
```
let map:bmap[] = [ foo=1 bar=2 ]
```Should act identically to the existing HashMap-based associative array.
```
let map:bmap[] = [ foo=1 bar=2 ]
```Ion Shell v1.0.0stratactstratact1@gmail.comstratactstratact1@gmail.comhttps://gitlab.redox-os.org/redox-os/ion/-/issues/790Remove Plugin Support2018-07-23T03:51:54ZMichael Aaron Murphymmstick@pm.meRemove Plugin SupportWhile it was neat to see that it could be done, we should wait for a better solution that doesn't require using the C ABI.While it was neat to see that it could be done, we should wait for a better solution that doesn't require using the C ABI.Ion Shell v1.0.0Michael Aaron Murphymmstick@pm.meMichael Aaron Murphymmstick@pm.mehttps://gitlab.redox-os.org/redox-os/ion/-/issues/792if not: command does not exist2018-07-15T00:17:20ZMichael Aaron Murphymmstick@pm.meif not: command does not exist```
if not true; echo false; else echo true; end
```
```
ion: command not found: not
true
``````
if not true; echo false; else echo true; end
```
```
ion: command not found: not
true
```Ion Shell v1.0.0Michael Aaron Murphymmstick@pm.meMichael Aaron Murphymmstick@pm.mehttps://gitlab.redox-os.org/redox-os/ion/-/issues/793! as shorthand for `not` command2018-07-15T00:17:20ZMichael Aaron Murphymmstick@pm.me! as shorthand for `not` commandThis should be possible:
```
if ! true; echo false; else echo true; end
```This should be possible:
```
if ! true; echo false; else echo true; end
```Ion Shell v1.0.0Michael Aaron Murphymmstick@pm.meMichael Aaron Murphymmstick@pm.mehttps://gitlab.redox-os.org/redox-os/ion/-/issues/801Prompt Written w/ Quoted Multiline Inputs2018-10-20T18:17:41ZMichael Aaron Murphymmstick@pm.mePrompt Written w/ Quoted Multiline InputsThe prompt is not supposed to be written when there's a multi-line input, but it seems that's the case now.
```
~ # echo 'one
~ # two
~ # three
~ # four
~ # '
one
two
three
four
~ #
```The prompt is not supposed to be written when there's a multi-line input, but it seems that's the case now.
```
~ # echo 'one
~ # two
~ # three
~ # four
~ # '
one
two
three
four
~ #
```Ion Shell v1.0.0Grant CookseyGrant Cookseyhttps://gitlab.redox-os.org/redox-os/ion/-/issues/802Trim methods for strings2018-09-05T13:34:35ZMichael Aaron Murphymmstick@pm.meTrim methods for stringsWe should support:
- $trim()
- $trim_left()
- $trim_right()We should support:
- $trim()
- $trim_left()
- $trim_right()Ion Shell v1.0.0Grant CookseyGrant Cookseyhttps://gitlab.redox-os.org/redox-os/ion/-/issues/803Methods for hmap and bmap handling2021-06-01T12:30:15ZRoland KovácsMethods for hmap and bmap handlingAdd support for getting keys or key-value pairs from maps, as currently only values can be extracted.
```
@keys(map)
@entries(map)
```Add support for getting keys or key-value pairs from maps, as currently only values can be extracted.
```
@keys(map)
@entries(map)
```Ion Shell v1.0.0https://gitlab.redox-os.org/redox-os/ion/-/issues/854Backslash at end of comment gobbles next line2019-03-25T00:52:07ZAdminXVIIBackslash at end of comment gobbles next line```
echo auie # auieie\
auieauieie
```
outputs `auie`.```
echo auie # auieie\
auieauieie
```
outputs `auie`.Ion Shell v1.0.0https://gitlab.redox-os.org/redox-os/ion/-/issues/855Calling an alias that uses the `export` builtin results in a pipeline expansi...2021-01-08T00:19:28ZVoidNoireCalling an alias that uses the `export` builtin results in a pipeline expansion error**Reproduction:**
```
# alias foo="export FOO='bar'"
# foo
```
**Expected behaviour:** executes `export FOO='bar'`.
**Actual behaviour:** fails with error:
```
ion: pipeline expansion error: unable to pipe inputs to alias: 'foo = expor...**Reproduction:**
```
# alias foo="export FOO='bar'"
# foo
```
**Expected behaviour:** executes `export FOO='bar'`.
**Actual behaviour:** fails with error:
```
ion: pipeline expansion error: unable to pipe inputs to alias: 'foo = export FOO='bar''
```
**Build information:**
```
# uname -a
Linux a 4.19.30_1 #1 SMP PREEMPT Wed Mar 20 09:17:21 UTC 2019 x86_64 GNU/Linux
# ion --version
ion 1.0.0-alpha (x86_64-unknown-linux-gnu)
rev fde4aff113a0c7690a158d55ff1798b6d1e91369
```
ion was built with rustc 1.31.0Ion Shell v1.0.0https://gitlab.redox-os.org/redox-os/ion/-/issues/858Decimal crate doesn't allow building for targets like AArch642019-04-12T04:24:24ZAleksey HalahanDecimal crate doesn't allow building for targets like AArch64Hey there! Seems like the decimal crate cannot be built on a set of different architectures. [Here is an issue](https://github.com/alkis/decimal/issues/52) that was created a while ago regarding this problem on the decimal crate's git re...Hey there! Seems like the decimal crate cannot be built on a set of different architectures. [Here is an issue](https://github.com/alkis/decimal/issues/52) that was created a while ago regarding this problem on the decimal crate's git repository.
Maybe ion should move to a pure-rust implementation of decimal numbers? I think there should be a solution. Thanks!Ion Shell v1.0.0