djui / alias-tips

An oh-my-zsh plugin to help remembering those aliases you defined once
786 stars 50 forks source link

Python IndexError #2

Closed spiffin closed 9 years ago

spiffin commented 9 years ago

Hi, for some reason I'm getting a Python IndexError:

Traceback (most recent call last):
  File "../djui/alias-tips-master/alias-tips", line 39, in <module>
    main()
  File "../djui/alias-tips-master/alias-tips", line 24, in main
    aliases = get_aliases()
  File "../djui/alias-tips-master/alias-tips", line 20, in get_aliases
    return [(alias[0], alias[1].strip('\'')) for alias in aliases]
IndexError: list index out of range

Any idea why? I'm running Python 2.7.3 by the way.

Thanks.

djui commented 9 years ago

Thanks for reporting. I suspect your alias/shell resource file has different syntax than my script expects. Could you send or point me to your alias list?

spiffin commented 9 years ago

Hi, alias list:

' root" print "$cmd" eval "$cmd" } alias ac'=su ...=../.. ....=../../.. .....=../../../.. ......=../../../../.. 1='cd -' 2='cd -2' 3='cd -3' 4='cd -4' 5='cd -5' 6='cd -6' 7='cd -7' 8='cd -8' 9='cd -9' =sudo aac='su -ls \aptitude' acp='apt-cache policy' acs='apt-cache search' acsh='apt-cache show' adg='apt-get dist-upgrade' afind='ack-grep -il' afs='apt-file search --regexp' ag='apt-get upgrade' age=apt-get agi='apt-get install' allpkgs='aptitude search -F "%p" --disable-columns ~i' api=aptitude app='apt-cache policy' aps='aptitude search' as='aptitude -F "* %p -> %d \n(%v/%V)" --no-gui --disable-columns search' asrc='apt-get source' ati='aptitude install' au='apt-get update' cat='pygmentize -g' d='dirs -v | head -10' da='du -sch' dbp=dpkg-buildpackage debs-by-size='dpkg-query -Wf '\''x ${Installed-Size} ${Package} ${Status}\n'\'' | sed -ne '\''/^x /d'\'' -e '\''/^x (.) install ok installed$/s//\1/p'\'' | sort -nr' dir='command ls -lSrah' egrep='egrep --color=auto' g=git ga='git add' gaa='git add --all' gap='git add --patch' gb='git branch' gba='git branch -a' gbr='git branch --remote' gc='git commit -v' 'gc!'='git commit -v --amend' gca='git commit -v -a' 'gca!'='git commit -v -a --amend' gcl='git config --list' gclean='git reset --hard && git clean -dfx' gcm='git checkout master' gcmsg='git commit -m' gco='git checkout' gcount='git shortlog -sn' gcp='git cherry-pick' gcs='git commit -S' gd='git diff' gdc='git diff --cached' gdt='git difftool' ge=grep-excuses gg='git gui citool' gga='git gui citool --amend' ggpnp='git pull origin $(current_branch) && git push origin $(current_branch)' ggpull='git pull origin $(current_branch)' ggpur='git pull --rebase origin $(current_branch)' ggpush='git push origin $(current_branch)' gignore='git update-index --assume-unchanged' gignored='git ls-files -v | grep "^[[:lower:]]"' git-svn-dcommit-push='git svn dcommit && git push github master:svntrunk' gk='gitk --all --branches' gl='git pull' glg='git log --stat --max-count=10' glgg='git log --graph --max-count=10' glgga='git log --graph --decorate --all' glo='git log --oneline --decorate --color' globurl='noglob urlglobber ' glog='git log --oneline --decorate --color --graph' glp=_git_logprettily gm='git merge' gmt='git mergetool --no-prompt' gp='git push' gpoat='git push origin --all && git push origin --tags' gr='git remote' grba='git rebase --abort' grbc='git rebase --continue' grbi='git rebase -i' grep='grep --color=auto --exclude-dir={.bzr,.cvs,.git,.hg,.svn}' grh='git reset HEAD' grhh='git reset HEAD --hard' grmv='git remote rename' grrm='git remote remove' grset='git remote set-url' grt='cd $(git rev-parse --show-toplevel || echo ".")' grup='git remote update' grv='git remote -v' gsd='git svn dcommit' gsps='git show --pretty=short --show-signature' gsr='git svn rebase' gss='git status -s' gst='git status' gsta='git stash' gstd='git stash drop' gstp='git stash pop' gsts='git stash show --text' gts='git tag -s' gunignore='git update-index --no-assume-unchanged' gunwip='git log -n 1 | grep -q -c "--wip--" && git reset HEAD~1' gup='git pull --rebase' gvt='git verify-tag' gwc='git whatchanged -p --abbrev-commit --pretty=medium' gwip='git add -A; git ls-files --deleted -z | xargs -r0 git rm; git commit -m "--wip--"' help-zshglob=H-Glob history='fc -l 1' insecscp='scp -o "StrictHostKeyChecking=no" -o "UserKnownHostsFile=/dev/null"' insecssh='ssh -o "StrictHostKeyChecking=no" -o "UserKnownHostsFile=/dev/null"' jumpstat='autojump --stat' l='ls -lah' la='ls -lAh' lad='command ls -d .(/)' lh='command ls -hAl --color=auto' ll='ls -lh' llog='less /var/log/syslog' ls='ls --color=tty' lsa='ls -lah' lsbig='command ls -flh (.OL[1,10])' lsd='command ls -d (/)' lse='command ls -d (/^F)' lsl='command ls -l (@)' lsnew='command ls -rtlh (D.om[1,10])' lsnewdir='command ls -rthdl *(/om[1,10]) .(D/om[1,10])' lsold='command ls -rtlh (D.Om[1,10])' lsolddir='command ls -rthdl *(/Om[1,10]) .(D/Om[1,10])' lss='command ls -l (s,S,t)' lssmall='command ls -Srl (.oL[1,10])' lsw='command ls -ld (R,W,X.^ND/)' lsx='command ls -l *()' md='mkdir -p' mdstat='cat /proc/mdstat' mydeb='time dpkg-buildpackage -rfakeroot -us -uc' new=modified please=sudo po=popd pu=pushd rd=rmdir rmcdir='cd ..; rmdir $OLDPWD || cd $OLDPWD' 'root abd() { cmd'='"su -lc aptitude' 'root alias ad'=su 'root alias adg'=su rsync-copy='rsync -avz --progress -h' rsync-move='rsync -avz --progress -h --remove-source-files' rsync-synchronize='rsync -avzu --delete --progress -h' rsync-update='rsync -avzu --progress -h' se=simple-extract term2iso='echo '\''Setting terminal to iso mode'\'' ; print -n '\''\e%@'\' term2utf='echo '\''Setting terminal to utf-8 mode'\''; print -n '\''\e%G'\' tlog='tail -f /var/log/syslog' up='aptitude update ; aptitude safe-upgrade' url-quote='autoload -U url-quote-magic ; zle -N self-insert url-quote-magic' which-command=whence zrm='rm -R ~/.zgen'

spiffin commented 9 years ago

Hi, to clarify. It's a clean instal - with grml-zshrc (https://grml.org/zsh/) and a couple of added aliases.

spiffin commented 9 years ago

Hi, I've managed to figure it out - there's a conflict between some built-in aliases in grml-zshrc and the oh-my-zh debian plugin. If I disable the latter, all is well. Thanks

djui commented 9 years ago

Hej Simon. Sorry for the late reply.

I had another look at your aliases and I believe this is due to multi-line declared aliases, either in name or in value. I don't handle that case currently, because it would require me to actually parse the alias definition as a regular language.

For now I just added a better error handling which skips unparsable aliases. In a later instance, I could parse the aliases more accurately, however I the return on that timely effort is covering very small use cases.

Please let me know if this is an issue for you any longer, and I will reopen the issue and see what we can do.