Document cross platform single file JVM launcher script

Open
#8 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
48/100
Issue type
Documentation
Clarity
Mostly clear
Activity status
Stale
Tech stack
clojure
Domain
cli, documentation

Research direction

Use the Clojure example in the issue and its bb /tmp/xpclj.clj 1 2 3 entry point as the starting reference. Document the cross-platform single-file JVM launcher behavior, including the shown invocation and output, then verify the documented command reproduces the example.

Written by the indexing model from the issue text.

Description

;; This should only be executed by babashka

(defmacro setup [& body]
  (when (System/getProperty "babashka.version")
    `(do ~@body)))

(setup
  (def deps '{:deps {clj-time {:mvn/version "0.14.2"}}})
  (require '[babashka.process :as p])
  (-> (p/process (into ["clojure" "-Sdeps" deps "-M" *file*] *command-line-args*)
                 {:inherit true})
      deref :exit (System/exit)))

;; JVM code only reachable from here

(println "Hello from the JVM!")
(println *clojure-version*)
(println *command-line-args*)
(require '[clj-time.core :as t])
(println (t/hour (t/now)))

Usage:

$ bb /tmp/xpclj.clj 1 2 3
Hello from the JVM!
{:major 1, :minor 10, :incremental 1, :qualifier nil}
(1 2 3)
19
Dominant language
Clojure
Stars
67
Forks
37
Avg merge
1m
Merged PRs (30d)
1

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from babashka/book

All issues in babashka/book

Similar issues

More Clojure issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.