Fix: id_ls was broken when no id

This commit is contained in:
mrjk 2018-02-10 23:15:00 -05:00
parent 4604d5355b
commit ab939c1fa4
2 changed files with 10 additions and 3 deletions

View File

@ -164,13 +164,15 @@ idm_get ()
;; ;;
all_id_files) all_id_files)
ls $IDM_DIR_ID/*.env ls $IDM_DIR_ID/*.env || true
;; ;;
id_config) id_config)
if [ -f "$value" ]; then if [ -f "$value" ]; then
echo "id=$value" echo "id=$value"
cat $IDM_DIR_ID/$value.env cat $IDM_DIR_ID/$value.env
else
return 1
fi fi
;; ;;

View File

@ -110,15 +110,20 @@ idm_id_ls ()
for id in $(idm_get all_id); do for id in $(idm_get all_id); do
# Check if id is valid
idm_validate id_config $id || continue
# Detect if it is enalbed or not
if [ "$id" == "${SHELL_ID-}" ]; then if [ "$id" == "${SHELL_ID-}" ]; then
active='*' active='*'
else else
active=' ' active=' '
fi fi
# Parse the config
echo $( echo $(
eval "$(idm_get id_config $id)" eval "$(idm_get id_config $id)"
echo "$active:$id:$common_name ($email)" echo "$active:$id:${common_name-} (${email-})"
) )
done | column -t -s: -o' ' | idm_log DUMP - done | column -t -s: -o' ' | idm_log DUMP -
} }