Skip to content

Instantly share code, notes, and snippets.

@wfouche
Last active July 1, 2025 09:57
Show Gist options
  • Select an option

  • Save wfouche/af1a14982d0edf9a386f7c1a41fb338b to your computer and use it in GitHub Desktop.

Select an option

Save wfouche/af1a14982d0edf9a386f7c1a41fb338b to your computer and use it in GitHub Desktop.
Show newers versions of JBang //DEPS
import json, os, sys
os.system("jbang info tools %s > jbang-deps.json"%(sys.argv[1]))
file = open("jbang-deps.json")
d = json.load(file)
file.close()
os.unlink("jbang-deps.json")
os.system("jbang toolbox@maveniverse versions " + ",".join(d["dependencies"]))
@wfouche
Copy link
Author

wfouche commented Jul 1, 2025

jbang run jython-cli@jython jbang-deps.py asciidoc.java

image

python3 jbang-deps.py asciidoc.java

image

@wfouche
Copy link
Author

wfouche commented Jul 1, 2025

///usr/bin/env jbang "$0" "$@" ; exit $?
//DEPS org.asciidoctor:asciidoctorj:3.0.0
//DEPS org.asciidoctor:asciidoctorj-diagram:2.3.1
//DEPS org.asciidoctor:asciidoctorj-diagram-plantuml:1.2025.2

import org.asciidoctor.Asciidoctor;
import org.asciidoctor.Options;
import org.asciidoctor.SafeMode;

import java.io.File;

public class asciidoc {

    public static void main(String[] args) {
        Asciidoctor asciidoctor = Asciidoctor.Factory.create(); 
        asciidoctor.requireLibrary("asciidoctor-diagram");
        asciidoctor.convertFile(                                
                new File(args[0]),
                Options.builder()                               
                        .toFile(true)
                        .safe(SafeMode.UNSAFE)
                        .build());
    }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment