BashIt.kak a kakoune editor command line gateway.
See or clone the docs/javadoc, docs/coverage, and docs/tests for the API.
Download pre-built bashit.jar with sha256 hash check.
$ openssl dgst -sha256 bashit.kak-<version>.jar
USAGE:
bashit [-i | -debug] <BINARY|JAR|OTHER> [FLAGS] [args ...]
OPTIONS:
-i:
ignore output in Kakoune client
-debug:
terminal debugging of a java.lang.Process
BINARY|JAR|OTHER:
is on your PATH|CLASSPATH|OTHER
FLAGS:
are native to the BINARY|JAR|OTHER
DISCUSSION:
BashIt a Kakoune command line gateway. Easily invoke a
binary, jar, or any script/executable without leaving
the kakoune command line. With automated temp file setup
and teardown on stdin/out/err. Default invocation
opens the temporary file in current kakoune client.
The temporary file is deleted on programs exit,
invoke kakoune :write command to save the buffers
output to a file name and destination of your choosing.
NOTE:
:bashit stderr available in kakoune *debug* buffer
java -jar is automatically prefixed to <name>.jar calls
kotlinc -script is automatically prefixed to <name>.kts calls
EXAMPLE:
:bashit python3 --help
:bashit perl --help
:bashit bashit.run --help
:bashit brew info shellcheck
:bashit brew home shellcheck
:bashit howdoi -c -n 5 catch an exception kotlin
:bashit curl https://cheat.sh/:intro
:ansi-render see https://github.com/eraserhd/kak-ansi
:bashit open https://github.com/eraserhd/kak-ansi
Woman had me my man-pants, press play on the motivational song spotify Schubert: Ave Maria, D.839 or youtube and put yourself in scrutineers mode. Peer review time!
HTML format:
docs/javadoc docstrings with UML diagrams and Harvard referencing style.
docs/coverage 119 passing tests with 96% coverage.
docs/tests viewable results of all tests.
Building
@see gradle wrapper
@see shadowJar
Run the gradle command from the terminal in bashit.kak top level directory:
$ gradle wrapper
Linux/OSX:
$ ./gradlew shadowJar
Windows:
$ gradlew.bat shadowJar
The fat-jar is located:
$ bashit.kak/build/libs/bashit.kak-<version>.jar
Build with passing tests use:
$ ./gradlew build
Gradle is a command line tool:
$ ./gradlew --help
$ ./gradlew tasks
$ ./gradlew dependencies --configuration compileClasspath
NOTE:
Gradle can also build shared and static libraries, and executables in Assembler, C/C++ and Obj-C/C++
Installing
$ curl -s "https://get.sdkman.io" | bash
$ source "$HOME/.sdkman/bin/sdkman-init.sh"
$ sdk version
$ sdk install java 11.0.5-zulu
$ sdk install kotlin
$ sdk install gradle
$ sdk install kscript // optional
NOTE:
- The package
build.gradle.kts
targets Java 11 ProcessHandle- Run
$ sdk list java
to see all available java sdk’s. - See sdkman for more details.
- Run
- kscript is required for kakoune syntax highlighting through kotlin.kak
- Hyperskill & Jetbrains Academy 2019, Theory: Java Archive, What is Java Archive?, viewed on 05 Dec 2019, https://hyperskill.org/learn/step/4311
# kakoune command
define-command -params .. bashit %{ evaluate-commands %sh{ java -jar <your-path-to>/bashit.kak-<version>.jar "${kak_session}" "${@:1}" } }
# .bashrc command
if [[ -d "$HOME/.local/jars" ]] ; then
JARPATH="$HOME/.local/jars"
export JARPATH
fi
javajar.sh
#! /usr/bin/env bash
# `.jar` suffix is no longer required from bash command line
exec java -jar "$JARPATH/$1.jar" "${@:2}"
exit 1
# .bash_alias command
alias jj=<your-path-to>/javajar.sh
Alternate Setup (linux/osx/*nix)
# kakoune command
define-command -params .. bashit %{ evaluate-commands %sh{ bashit.run "${kak_session}" "${@:1}" } }
jars-linux.sh
#!/bin/sh
MYSELF=`which "$0" 2>/dev/null`
[ $? -gt 0 -a -f "$0" ] && MYSELF="./$0"
java=java
if test -n "$JAVA_HOME"; then
java="$JAVA_HOME/bin/java"
fi
exec "$java" $java_args -jar $MYSELF "$@"
exit 1
$ cat jars-linux.sh bashit.kak-<version>.jar > bashit.run && chmod u+x bashit.run && mv bashit.run ~/.local/bin/
@author Tommaso, P 2019, How to make a JAR file Linux executable, corderwall.com, viewed on 6 Jan 2019, https://coderwall.com/p/ssuaxa/how-to-make-a-jar-file-linux-executable
TODO:
/*
* bitbucket repo ✅
* uml diagrams ✅
* logger ✅
* mockk ✅
* tests with coverage ✅
* dokka api, docstrings and references ✅
* build fatjar ✅
* post on discuss.kakoune ✅
*/
NOTE:
Before running ./gradlew
command run:
$ ps aux | grep java
Note the process_id of all current running java processes.
Then run all the required ./gradlew
commands, after re-run the previous ps
command for any additional unclosed java process noting their process_id.
You can then use the:
$ kill process_id
to terminate the additional running java process.
The cause is strictly ./gradlew
command and NOT bashit.run
or bashit.jar
.
Kakoune General Information
Kakoune is an open source modal editor. The source code lives on github mawww/kakoune.
A discussion on the repository structure of ’community plugins’ for Kakoune can be reviewed here: Standardi(s|z)ation of plugin file-structure layout #2402.
Read the Kakoune wiki for information on install options via a Plugin Manager.
And thank you to the Kakoune community 180+ contributors for a great modal editor in the terminal. I use it everyday for those keyboard shortcuts.