• Stars
    star
    129
  • Rank 277,642 (Top 6 %)
  • Language
    Python
  • License
    GNU General Publi...
  • Created over 1 year ago
  • Updated 9 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Compile Justfiles to portable shell scripts

just.sh

just.sh transpiles Justfiles to portable, POSIX-compatible shell scripts.

  • Run Justfile recipes without installing just
  • Run just commands in constrained environments (such as CI pipelines and Docker containers)
  • Use a justfile as a starting point for a shell script

just.sh is built as a drop-in replacement for just. It can parse any valid justfile, and generated scripts behave identically to just. In almost all cases, generated scripts even have byte-for-byte identical output to just. There are over 32,000 tests (covering every line of code!) that validate this compatibility for each commit.

Install & Quick Start

Try just.sh online without installing.

Install just.sh locally with:

python3 -m pip install just.sh

Once installed, run just.sh to convert a Justfile to a shell script. Then, run the generated script ./just.sh as you would run just.

$ ls
justfile

$ just --summary
build lint test

$ just.sh
Compiling Justfile to shell script: `justfile` -> `just.sh`

$ ls
justfile just.sh

$ ./just.sh --summary
build lint test

The pip installation script also installs the following aliases to the just.sh command-line tool:

  • just_sh
  • just-sh
  • pyjust

Project Status

I like tools that effectively achieve one well-defined goal, without growing indefinitely. My hope is for just.sh to be such a tool.

In other words, just.sh is "complete" software. I will fix bugs and make changes to maintain compatibility with just, but there are no new features planned.

As such, even if there are no recent commits, the project is not dead! Few commits means that everything has been running smoothly.

just.sh is written in Python with only one dependency outside the Python standard library: parsy, which itself has no external dependencies. All of the code is spread across two fairly small files (plus one more for tests), and every line of code is covered by tests.

Known Issues & Incompatibilities

  • Not all Just functions are implemented in shell
    • For example, many of the string manipulation functions such as trim_end_match, trim_start_match, titlecase, etc. remain to be implemented
    • Trying to compile a Justfile with an unimplemented function will raise an error
  • Some Just functions (sha256 in particular) cannot be made portable without depending on sha256sum or Python on the target system
  • Not all nested calls to just are detected. Calling just in the middle of a recipe may result in unexpected behavior
  • 100% Python line coverage guarantees that all Python code that generates shell scripts is exercised, but it does not guarantee that all generated lines of shell are exercised in tests
  • Just re-runs recipes if they are called again with a unique combination of arguments. just.sh approximates this behavior instead of replicating it, using simpler heuristics for whether a recipe has run before
  • Generated just.sh shell files may be hard to read, and are typically much larger than the Justfiles they replace
  • import, [confirm], and possibly some other recent features from Just versions greater than 1.14.0 may not yet be supported
  • The ./just.sh --dump command does not reformat Justfiles
  • The tests check colorless output of just.sh against just. They do not confirm that the colors and ANSI escape sequences are the same between the two

Acknowledgments

  • Thanks to Logan Snow for testing early versions, consulting on design decisions, and being a great guy overall

More Repositories

1

github-stats

Better GitHub statistics images for your profile, with stats from private repos too
Python
2,856
star
2

urlpages

Create and view web pages stored entirely in the URL
JavaScript
1,372
star
3

link-lock

Password-protect URLs using AES in the browser; create hidden bookmarks without a browser extension
JavaScript
856
star
4

paperify

Transform any document, web page, or eBook into a research paper (ChatGPT not required)
Shell
364
star
5

systems-programming-cheat-sheet

Cheat sheet for x86-64 Unix systems programming
TeX
359
star
6

quickserv

Dangerously user-friendly web server for quick prototyping and hackathons
Go
322
star
7

poker-chipper

Optimally allocate poker chips using constrained, nonlinear optimization
Svelte
172
star
8

hackernews-button

Privacy-preserving Firefox extension linking to Hacker News discussion; built with Bloom filters and WebAssembly
C
84
star
9

ctf-collab

Collaborative programming environment inside GitHub Actions – like Google Docs for hacking
Shell
69
star
10

panopto-download

Script to facilitate batch downloading of lecture videos from Panopto
Python
43
star
11

homework-template

Typeset assignments and problem sets using LaTeX; typographically optimized for online submission
TeX
32
star
12

procrastinate

One button, infinite web comics. Never focus again.
JavaScript
11
star
13

quickserv-examples

Example applications to run with QuickServ
C
9
star
14

jstrieb

Jacob Strieb GitHub profile README including automatically-generated profile statistics
6
star
15

webash

A cursed bash web application that makes more cursed bash web applications
Shell
6
star
16

groupme-latex

GroupMe bot to render LaTeX equations and send them as images
Python
6
star
17

remote-ofrak

Run OFRAK remotely to modify and repack binaries from your browser
5
star
18

bruteforce-link-lock

Brute force protected Link Lock URLs in parallel on the CPU
Go
5
star
19

dotfiles

Linux dotfiles and setup script
Shell
2
star
20

zoom-download

Browser extension to download recorded Zoom videos
JavaScript
2
star
21

killfam

Pure Go implementation of cross-platform process tree killing
Go
2
star
22

groupme-archiver

GUI to download GroupMe chats for archival and offline analysis
Java
1
star
23

brainfuck

A Linux brainfuck interpreter written in x86-64 Assembly
Assembly
1
star
24

rightclick-pdf

Firefox extension to add a "Save as PDF" button to the right-click context menu
JavaScript
1
star