Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/workflows/TerminalNightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ on:
- '.github/workflows/TerminalNightly.yml'
- 'Sources/Terminal/AngouriMath.Terminal/publish.sh'
- 'Sources/Terminal/AngouriMath.Terminal/pack-deb-linux.sh'
- 'Sources/Terminal/AngouriMath.Terminal/amcli.1'
- 'Sources/Terminal/AngouriMath.Terminal/amcli.bash'
workflow_dispatch:
inputs:
version:
Expand Down
85 changes: 85 additions & 0 deletions Sources/Terminal/AngouriMath.Terminal/amcli.1
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
.TH AMCLI 1 "" "AngouriMath" "User Commands"
.SH NAME
amcli \- the AngouriMath terminal, and commands that answer once
.SH SYNOPSIS
.B amcli
.br
.B amcli
.I command
.RI [ argument ...]
.SH DESCRIPTION
With no arguments,
.B amcli
opens the AngouriMath terminal: an F# prompt with AngouriMath loaded.
.PP
With a command,
.B amcli
answers once and exits, without starting F#, so that it can sit in a pipe or a script.
An argument written as
.BR _ ,
or left out, is read from standard input.
.SH COMMANDS
.TP
.BI eval " expr"
Evaluates
.I expr
to a number, a boolean, or a + bi. A rational is written as a decimal.
.TP
.BI simp " expr"
Simplifies
.IR expr .
.TP
.BI fsimp " expr"
Simplifies
.I expr
quickly: the normalisation, without the search.
.TP
.BI diff " var expr"
Differentiates
.I expr
over
.IR var .
.TP
.BI solve " var statement"
Solves
.I statement
over
.IR var ,
one root per line when there are finitely many.
.TP
.BI sub " var value expr"
Substitutes
.I value
for
.I var
in
.IR expr .
.TP
.BI latex " expr"
Writes
.I expr
as LaTeX.
.TP
.BI info " expr"
Describes
.IR expr :
its variables, the derivative and the roots over each, and its stationary points, each classified
by the second derivative test.
.TP
.B help
Lists the commands.
.SH EXIT STATUS
0 for an answer; 1 when the input does not parse or cannot be answered; 2 for a command that
does not exist or is missing an argument.
.SH EXAMPLES
.nf
$ amcli simp "sin(x)^2 + cos(x)^2"
1
$ amcli solve x "x^2 \- 1 = 0"
1
\-1
$ echo "1 + x^2" | amcli diff x
2 * x
.fi
.SH SEE ALSO
https://am.angouri.org
9 changes: 9 additions & 0 deletions Sources/Terminal/AngouriMath.Terminal/amcli.bash
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Bash completion for amcli, the AngouriMath terminal: the command after it.
_amcli()
{
local current="${COMP_WORDS[COMP_CWORD]}"
if [ "$COMP_CWORD" -eq 1 ]; then
COMPREPLY=( $(compgen -W "eval simp fsimp diff solve sub latex info help" -- "$current") )
fi
}
complete -F _amcli amcli angourimath-terminal
13 changes: 12 additions & 1 deletion Sources/Terminal/AngouriMath.Terminal/pack-deb-linux.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
# The .deb's version is the release's: TerminalNightly.yml passes the packages' version, read
# from the release's tag.
version="${TERMINAL_VERSION:?set TERMINAL_VERSION to the version to pack, such as 2.6.0}"
# The package's modes come from the umask it is packed under: dpkg-deb refuses a control directory
# other users cannot read, and what it installs has to be readable by them too.
umask 022
cd publish-output

for arch in amd64 arm arm64
Expand All @@ -27,8 +30,16 @@ do
mkdir -p ./usr/share/applications/
cp -r ../$dotnet_arch ./usr/local/bin
mv ./usr/local/bin/$dotnet_arch ./usr/local/bin/angourimath-terminal-data
echo 'cd /usr/local/bin/angourimath-terminal-data && ./AngouriMath.Terminal' > ./usr/local/bin/angourimath-terminal
# The arguments go through, so that `amcli simp "..."` answers once, and amcli is the same
# launcher under the name the dotnet tool has.
printf '#!/bin/sh\ncd /usr/local/bin/angourimath-terminal-data && exec ./AngouriMath.Terminal "$@"\n' > ./usr/local/bin/angourimath-terminal
chmod +x ./usr/local/bin/angourimath-terminal
ln -s angourimath-terminal ./usr/local/bin/amcli

mkdir -p ./usr/share/man/man1/
gzip -9 -n -c ../../amcli.1 > ./usr/share/man/man1/amcli.1.gz
mkdir -p ./usr/share/bash-completion/completions/
install -m 0644 ../../amcli.bash ./usr/share/bash-completion/completions/amcli

mkdir DEBIAN && cd DEBIAN
touch control
Expand Down
Loading