#!/bin/bash

findFiles() {
	find ~/.m2/ -iname '*.jar' -printf '%p\0';
}

fetchAttributes() {
	relpipe-in-filesystem \
		--parallel 4 \
		--file path \
		--streamlet jar_info;
}

filterRunable() {
	relpipe-tr-awk --relation '.*' --where 'main_class';
}

shortenPath() {
	relpipe-tr-sed --relation '.*' --attribute 'path' --value "^$HOME/?" --replacement "~/";
}

findFiles | fetchAttributes | filterRunable | shortenPath | relpipe-out-tabular
