Radish alpha
r
Radicle terminal user interface
Radicle
Git (anonymous pull)
Log in to clone via SSH
Provide Radicle CLI integration preview
Erik Kundt committed 1 year ago
commit 81424fd335bb77e753b9eb5ad00956a39a77edf9
parent 9ed6a954bb40a0eba2e32270ac1b525c6d06ad53
1 file changed +43 -0
added scripts/rad.sh
@@ -0,0 +1,43 @@
+
#!/bin/bash
+
extract_operation() {
+
    local op=$(echo $1 | jq '.operation')
+
    op=${op//\"/""}
+
    
+
    echo "$op"
+
}
+

+
extract_id() {
+
    local ids=$(echo $1 | jq '.ids')
+
    local id=$(echo $ids | jq '.[0]')
+
    id=${id//\"/""}
+
    
+
    echo "$id"
+
}
+

+
if [[ "$1" == "patch" ]] || [[ "$1" == "issue" ]] || [[ "$1" == "inbox" ]]; then
+
    if [[ -n "$2" ]]; then
+
        if [[ "$2" == "--tui" ]]; then
+
            # Run TUI
+
            { out=$(rad-tui $1 select 2>&1 >&3 3>&-); } 3>&1
+
            if [[ "$out" == "" ]]; then
+
                exit 1
+
            fi
+
            
+
            op=$(extract_operation $out)
+
            id=$(extract_id $out)
+
            
+
            rad $1 $op $id
+
        else
+
            # Run TUI
+
            args="--mode id"
+
            { out=$(rad-tui $1 select $args 2>&1 >&3 3>&-); } 3>&1
+
            id=$(extract_id $out)
+
            
+
            rad $1 $2 $id
+
        fi
+
    else
+
        rad $@
+
    fi
+
else
+
    rad $@
+
fi

\ No newline at end of file