Skip to content

Commit

Permalink
Completion working now
Browse files Browse the repository at this point in the history
  • Loading branch information
pchakraborty committed Oct 2, 2024
1 parent 439959c commit 4a27498
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 10 deletions.
19 changes: 9 additions & 10 deletions etc/mepo-completion.bash
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,17 @@

# complete -W "init clone status checkout branch diff where whereis history" mepo

# SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
SCRIPT_DIR=$(dirname $(realpath $0))

_get_mepo_commands() {
local mepo_cmd_list=""
if [[ "$OSTYPE" == "darwin"* ]]
then
local mepodir=$(dirname $(readlink $(which mepo)))
else
local mepodir=$(dirname $(readlink -f $(which mepo)))
fi
for mydir in $(ls -d ${mepodir}/mepo.d/command/*/); do
if [[ $mydir != *"__pycache__"* ]]; then
mepo_cmd_list+=" $(basename $mydir)"
fi
local mepo_dir=$(python3 $SCRIPT_DIR/mepo-path.py)
for pyfile in $(ls ${mepo_dir}/command/*.py*); do
command=${pyfile##*/} # remove path
command=${command%.*} # remove extension
command=$(echo $command | cut -d _ -f 1)
mepo_cmd_list+=" $command"
done
echo ${mepo_cmd_list}
}
Expand Down
3 changes: 3 additions & 0 deletions etc/mepo-path.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import os, mepo

print(os.path.dirname(mepo.__file__))

0 comments on commit 4a27498

Please sign in to comment.