yash-rs icon indicating copy to clipboard operation
yash-rs copied to clipboard

Implementing built-ins (non-POSIX extensions)

Open magicant opened this issue 2 years ago • 0 comments

This issue tracks the implementation of non-portable extensions for built-in utilities. Portable features are tracked in #7.

In the list below, built-ins are grouped by their dependent environments. However, most built-ins additionally depend on the standard output and error file descriptors and variables.

Execution control

  • .
    • Non-portable options
      • [ ] -A, --no-alias
      • [ ] -L, --autoload
      • [ ] --help
  • break
    • Non-portable options
      • [ ] -i, --iteration
      • [ ] --help
  • continue
    • Non-portable options
      • [ ] -i, --iteration
      • [ ] --help
  • eval
    • Non-portable options
      • [ ] -i, --iteration
      • [ ] --help
  • exec
    • Non-portable options
      • [ ] -a ..., --as=...
      • [ ] -c, --clear
      • [ ] --cloexec
      • [ ] -f, --force
      • [ ] --help
  • exit
    • Semantics
      • [x] Allow exit status of 256+
      • [ ] Do not exit if there is a stopped job
    • Non-portable options
      • [ ] -f, --force
      • [ ] --help
  • ~~newgrp~~
  • return
    • Semantics
      • [ ] Allow exit status of 256+
      • [ ] Only return from functions and dot scripts in POSIXly-correct mode (Reject returning from trap, exiting the shell, etc.)
    • Non-portable options
      • [ ] -n, --no-return
      • [ ] --help

Printing

  • echo
    • [ ] Implement echo built-in
  • help
    • [ ] Implement help built-in
  • printf
    • [ ] Implement printf built-in

Working directory

  • cd
    • Semantics
      • [ ] Allow - operand used together with -L or -P option
      • [ ] $YASH_AFTER_CD
    • Non-portable options
      • [ ] Long options
      • [ ] --default-directory=...
      • [ ] --help
  • dirs
    • [ ] Show directory stack
  • popd
    • [ ] Update directory stack
  • pushd
    • [ ] Update directory stack
  • pwd
    • Non-portable options
      • [ ] Long options
      • [ ] --help

File creation mask

  • umask
    • Non-portable options
      • [ ] Long options
      • [ ] --help

Limits

  • ulimit
    • Semantics
      • [ ] Support limits other than file size (-f)
    • Non-portable options
      • [ ] Long options
      • [ ] --help

Spent times

  • times
    • Non-portable options
      • [ ] --help

Signals

  • kill
    • Semantics
      • [ ] (Dis)allow signal names prefixed with SIG
      • [ ] (Dis)allow non-zero numbers as an argument to -s option
      • [ ] (Dis)allow signal names as operands for -l option
      • [ ] (Dis)allow multiple operands with -l option
    • Non-portable options
      • [x] -n
      • [x] -v
      • [ ] Include descriptions with -v
      • [ ] --help
  • suspend
    • [ ] Implement suspend built-in
  • trap
    • Semantics
      • [ ] Allow non-uppercase signal names
      • [ ] Allow signal names prefixed with SIG
    • Non-portable options
      • [ ] -p, --print
      • [ ] --help

Jobs

  • bg
    • Semantics
      • [ ] Allow job IDs without the % prefix
      • [ ] Send SIGCONT even if the target job is already running
    • Non-portable options
      • [ ] --help
  • disown
    • [ ] Implement disown built-in
  • fg
    • Semantics
      • [ ] Allow job IDs without the % prefix
      • [ ] Allow more than one job ID operand per invocation
      • [ ] Print the job number on resuming a job
      • [ ] Consider saving/restoring the terminal state before/after resuming the job
    • Non-portable options
      • [ ] --help
  • jobs
    • Semantics
      • [ ] Allow job IDs without the % prefix
    • Non-portable options
      • [x] Long options
      • [ ] -n, --new
      • [ ] -r, --running-only
      • [ ] -s, --stopped-only
      • [ ] -t, --terminated-only
      • [ ] (Idea: option to print the locations jobs were started at)
      • [ ] --help
  • wait
    • Semantics
      • [ ] Print job status after waiting (if interactive and monitoring)
    • Non-portable options
      • [ ] --help

Variables and functions

  • array
    • [ ] Implement array built-in
  • export
    • [ ] Disable non-portable syntax in POSIX mode / Allow non-portable extensions in non-POSIX mode
    • Non-portable options
      • [ ] --help
      • [ ] Legacy options (-r and -X)
  • getopts
    • Semantics
      • [ ] Allow parsing non-alphanumeric options
    • Non-portable options
      • [ ] --help
  • local
    • [ ] Redirect local to typeset
  • read
    • Non-portable options
      • [ ] Long options
      • [ ] -A, --array
      • [ ] -e, --line-editing
      • [ ] -P, --ps1
      • [ ] -p ..., --prompt=...
      • [ ] --help
  • readonly
    • [ ] Disable non-portable syntax in POSIX mode / Allow non-portable extensions in non-POSIX mode
    • Non-portable options
      • [ ] --help
      • [ ] Legacy options (-x and -X)
  • shift
    • Semantics
      • [ ] Allow negative operands
    • Non-portable options
      • [ ] -A ..., --array=...
      • [ ] --help
  • typeset
    • [ ] #316
  • unset
    • Semantics
      • [ ] Allow unset used without any operands
    • Non-portable options
      • [ ] Long options
      • [ ] -l, --local
      • [ ] --help

Aliases

  • alias
    • Semantics
      • [ ] Allow/reject non-portable alias names
    • Non-portable options
      • [ ] -g, --global
      • [ ] -p, --prefix
      • [ ] -v, --verbose (show locations where aliases were defined)
      • [ ] --help
  • unalias
    • Non-portable options
      • [ ] Long options
      • [ ] --help

Command path cache

  • hash
    • Non-portable options
      • [ ] Long options
      • [ ] -a, --all
      • [ ] -d, --directory
      • [ ] --help

Built-ins

  • builtin, disable (TBD)
    • [ ] Execute a built-in (ignoring the same-named functions)
    • [ ] Disable built-ins
    • [ ] Re-enable built-ins

Command history

  • fc
    • Non-portable options
      • [ ] Long options
      • [ ] -q, --quiet
      • [ ] -v, --verbose
      • [ ] --help
  • history
    • [ ] Implement history built-in

Line-editing

  • bindkey
    • [ ] Implement bindkey built-in
  • complete
    • [ ] Implement complete built-in

Miscellaneous

  • [, test
    • [ ] -G
    • [ ] -k
    • [ ] -N
    • [ ] -O
    • [ ] -nt, -ot
    • [ ] -ef
    • [ ] ==
    • [ ] Locale-based string comparison (===, !==, <, <=, >, >=)
    • [ ] =~
    • [ ] Version number comparison (-veq, -vne, -vgt, -vge, -vlt, -vle)
    • [ ] -o (unary)
  • command, type
    • Semantics
      • [ ] Allow -v and -V used together
      • [ ] Allow more than one command name operand for -v and -V
      • [ ] Disable invalid option combination (e.g. type -f)
    • Non-portable options
      • [ ] Long options
      • [ ] -a, --alias
      • [ ] -b, --builtin-command
      • [ ] -e, --external-command
      • [ ] -f, --function
      • [ ] -k, --keyword
      • [ ] --help
  • set
    • [ ] Disable non-portable options in POSIXly-correct mode
    • [ ] Disable long options in POSIXly-correct mode
    • [ ] Disable non-portable use of the no prefix
    • [ ] Disable non-portable normalization & case folding of option names
    • [ ] --help

magicant avatar May 28 '23 03:05 magicant