about summary refs log tree commit diff
path: root/Makefile
diff options
context:
space:
mode:
authorFilippo Valsorda <filippo.valsorda@gmail.com>2012-08-01 17:26:50 +0200
committerFilippo Valsorda <filippo.valsorda@gmail.com>2012-08-01 17:26:50 +0200
commitce7b2a40d04de1eadd5b81910ad374fee8db268d (patch)
tree5519fa77dd78331eaa49d33a1c53f16a6109a277 /Makefile
parentcfcec693315c7f463c9364fd8b9d96f6e090f439 (diff)
downloadyoutube-dl-ce7b2a40d04de1eadd5b81910ad374fee8db268d.tar.gz
youtube-dl-ce7b2a40d04de1eadd5b81910ad374fee8db268d.tar.xz
youtube-dl-ce7b2a40d04de1eadd5b81910ad374fee8db268d.zip
added automatically generated bash-completion; closes #191
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile10
1 files changed, 8 insertions, 2 deletions
diff --git a/Makefile b/Makefile
index c31850a55..da9103cd2 100644
--- a/Makefile
+++ b/Makefile
@@ -1,4 +1,4 @@
-all: compile exe readme man-page update-latest
+all: compile exe readme man-page bash-completion update-latest
 
 update-latest:
 	./youtube-dl --version > LATEST_VERSION
@@ -18,6 +18,11 @@ readme:
 man-page:
 	pandoc -s -w man README.md -o youtube-dl.1
 
+bash-completion:
+	@options=`egrep -o '(--[a-z-]+) ' README.md | sort -u | xargs echo` && \
+		content=`sed "s/opts=\"[^\"]*\"/opts=\"$${options}\"/g" youtube-dl.bash-completion` && \
+		echo "$${content}" > youtube-dl.bash-completion
+
 compile:
 	zip --quiet --junk-paths youtube-dl youtube_dl/*.py
 	echo '#!/usr/bin/env python' > youtube-dl
@@ -30,5 +35,6 @@ exe:
 install:
 	install -m 755 --owner root --group root youtube-dl /usr/local/bin/
 	install -m 644 --owner root --group root youtube-dl.1 /usr/local/man/man1
+	install -m 644 --owner root --group root youtube-dl.bash-completion /etc/bash_completion.d/youtube-dl
 
-.PHONY: all update-latest readme man-page compile exe install
\ No newline at end of file
+.PHONY: all update-latest readme man-page bash-completion compile exe install
\ No newline at end of file