This commit is contained in:
2024-11-13 01:17:25 -05:00
parent 0ed24ed43b
commit 9ac157315a
10 changed files with 148 additions and 24 deletions
-20
View File
@@ -2,25 +2,6 @@
autoload -U compinit
compinit
function findJJSource {
# @source http://stackoverflow.com/a/246128/330439
local SOURCE="$jjCpmmandRunPoint"
local DIR=""
while [[ -h "$SOURCE" ]]; do
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
SOURCE="$(readlink "$SOURCE")"
[[ $SOURCE != /* ]] && SOURCE="$DIR/$SOURCE"
done
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
while [[ ! -e "${DIR}/jj.filelocation" ]]; do
DIR=$(dirname "${DIR}")
done
echo "${DIR}"
}
export JJ_SOURCE_DIR=$(findJJSource)
if [[ -e "$JJ_SOURCE_DIR/~~tmp/shEnvs.sh" ]]; then
source $JJ_SOURCE_DIR/~~tmp/shEnvs.sh
fi
@@ -29,7 +10,6 @@ fi
typeset -A opt_args
function _AuctoCompletion(){
# echo $words
COMMANDS_WITH_HELP=$($JJ_SOURCE_DIR/bashUtils/auto-completion.ts "1" $words )
COMMANDS=$($JJ_SOURCE_DIR/bashUtils/auto-completion.ts "0" $words )
+8 -2
View File
@@ -1,6 +1,7 @@
#!/usr/bin/env bun
import { bashRunAndReturnSync } from "@helpers/bashUtils"
import { dynamicStringHandler } from "@helpers/dynamicStringHandler"
import { getJJConfigByKeyChain } from "@helpers/jjConfigUtils"
async function main() {
@@ -33,9 +34,14 @@ async function main() {
}
const oldArgOrder = remainingArgsCount
remainingArgsCount = 0
const command =
let command =
matchingCommand?.commandForRetrieveKeys + ` ${matchingCommand?.commandForRetrieveKeys?.includes("auto-completion") ? ` auto-completion ${process.argv.join(" ")}` : ""}`
const res = await bashRunAndReturnSync(command)
command = dynamicStringHandler(command, "", process.env, false)
// console.log(command);
const res = await bashRunAndReturnSync({
command
})
// console.log(res)
const newCommands = res?.split("\n") || []
newCommands.push(String(""))
lastArrayOfKeys = []
+12
View File
@@ -0,0 +1,12 @@
#!/usr/bin/env bun
import { getJJConfigByKeyChain } from "@helpers/jjConfigUtils"
const firstArg = process.argv[2]
if(firstArg == 'jj-environments-keys'){
const environments = getJJConfigByKeyChain('environments')
console.log(Object.keys(environments).join("\n"))
}
process.exit(0)