Last active
September 25, 2024 02:27
-
-
Save joshlong/035a7f54658e29c256f369655178aadd to your computer and use it in GitHub Desktop.
this does the same thing as my existing unzip-and-open.py, but in less code and faster, with a compiler to help me.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// I'd suggest you create an alias somewhere: | |
// alias uao=java --enable-preview --source 21 $HOME/bin/UAO.java | |
// RUN: uao $HOME/Downloads/demo.zip | |
import java.io.*; | |
import java.util.function.*; | |
import java.util.* ; | |
void main(String[] args) throws Exception { | |
var zipFile = new File(args[0]); | |
var zipFileAbsolutePath = zipFile.getAbsolutePath(); | |
var folder = new File(zipFileAbsolutePath.substring(0, zipFileAbsolutePath.lastIndexOf("."))); | |
new ProcessBuilder().command("unzip", "-a", zipFileAbsolutePath).inheritIO().start().waitFor(); | |
for (var k : Set.of("build.gradle", "build.gradle.kts", "pom.xml")) { | |
var buildFile = new File(folder, k); | |
if (buildFile.exists()) { | |
new ProcessBuilder().command("idea", buildFile.getAbsolutePath()).inheritIO().start().waitFor(); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment