Skip to content

Commit

Permalink
Fejlkorrektion skal også understøtte aliaser.
Browse files Browse the repository at this point in the history
  • Loading branch information
athas committed Aug 20, 2024
1 parent b696750 commit 7ae69d7
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions concieggs/eggspi/runcmd
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,15 @@ if [ "$cmd" ] && [ "$EGGS_USER" != "$CONCIEGGS_NAME" ]; then
othercmd="$(commands $check_all_places|levenshtein "$cmd"|sort -n|head -n 1|cut -d ' ' -f 2- | tolower)"
if [ "$othercmd" ]; then
echo "$EGGS_USER: Jeg antager at du mente $othercmd!"

alias="$(cmdAlias "$EGGS_USER" "$othercmd")"
if [ "$alias" ]; then
othercmd="$(echo "$alias " | cut -s -d' ' -f 1)"
args="$(echo "$alias " | cut -s -d' ' -f 2-) $@"
else
args="$@"
fi

otheracmd="$(find "$CONCIEGGS_DIR/cmds" -name "$othercmd" | head -n 1)"
run "$othercmd" "$otheracmd" $args || run "$othercmd" "$(echo "$otheracmd" | tolower)" $args
else
Expand Down

0 comments on commit 7ae69d7

Please sign in to comment.