Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

_id3: initial commit

  • Loading branch information...
commit 513546f59f9cc24e9ac86ff9d85c6b48f18d4e5a 1 parent 2b9822e
@Valodim Valodim authored
Showing with 64 additions and 0 deletions.
  1. +64 −0 src/_id3
View
64 src/_id3
@@ -0,0 +1,64 @@
+#compdef id3
+
+# ------------------------------------------------------------------------------
+# Description
+# -----------
+#
+# Completion script for id3, based on v0.15
+#
+# Last updated: 03.04.2013
+#
+# ------------------------------------------------------------------------------
+# Authors
+# -------
+#
+# * Valodim ( https://github.com/Valodim )
+#
+# ------------------------------------------------------------------------------
+
+_id3_genre () {
+
+ setopt localoptions extendedglob
+
+ local -A _id3_genres
+ # got them cached?
+ if _cache_invalid id3-genres || ! _retrieve_cache id3-genres ; then
+
+ # generate from id3 -L otherwise
+ local tmp
+ for line in ${${${(f)"$(_call_program id3genre id3 -L)"}## #}}; do
+ tmp=( ${(s,: ,)line} )
+ _id3_genres[${tmp[1]}]=$tmp[2]
+ # alternate display string, which I decided against in the end
+ # to preserve reasonable alphabetic sorting
+ # "${(l:3:: :)${tmp[1]}}: ${tmp[2]}"
+ done
+
+ # store if we got any
+ (( $#_id3_genres > 0 )) && _store_cache id3-genres _id3_genres
+ fi
+
+ # bail if we don't
+ (( $#_id3_genres > 0 )) || { _message "could not fetch genres"; return }
+
+ _wanted id3genres expl 'Genres' \
+ compadd -d _id3_genres -k _id3_genres && return 0
+
+}
+
+_arguments \
+ '-t[Modifies a Title tag]:title' \
+ '-T[Modifies a Track tag]:track' \
+ '-a[Modifies an Artist tag]:artist' \
+ '-A[Modifies an Album tag]:album' \
+ '-y[Modifies a Year tag]:year' \
+ '-c[Modifies a Comment tag]:comment' \
+ '-g[Modifies a Genre tag]:genre:_id3_genre' \
+ '(-)-l[Lists an ID3 tag]' \
+ '-R[Uses an rfc822-style format for output]' \
+ '(-)-d[Deletes an ID3 tag]' \
+ '(- *)-L[Lists all genres]' \
+ '(- *)-h[Displays this help info]' \
+ '(- *)-v[Prints version info]' \
+ '*:mp3 file:_files -g \*.mp3' && return 0
+
Please sign in to comment.
Something went wrong with that request. Please try again.