Anonymous avatar Anonymous committed e515e05

enh: add-apt-repository support, improve readme

Comments (0)

Files changed (2)

 from optparse import OptionParser
 
 # initialization
-__version__ = '0.95'
-use_sudo = ('apt-get', 'apt-get remove', 'aptitude', 'apt-key', 'dpkg -i')
+__version__ = '0.96'
+use_sudo = ('apt-get', 'apt-get remove', 'aptitude', 'apt-key', 'dpkg -i',
+            'add-apt-repository ')
+
 # map commands to their appropriate binaries:
 cmd_map = {
     # apt-get
     'listfiles': 'dpkg-query -L',
     'searchfiles': 'dpkg-query -S',
     'instdeb': 'dpkg -i',
+    'addrepo': 'add-apt-repository ',  # trailing space hack to override cmd
 }
 commands = sorted(set(cmd_map.keys()))  # make a list for the user
 
 
 
 # build command line
-cmdline = prefix + ' '.join([binary, command] + args[1:])
+cmdline = (prefix + ' '.join([binary, command] + args[1:])).replace('  ', ' ')
 if opts.debug:
     print 'Running:', cmdline
 
 APT, a Command-line Wrapper
 ============================
 
-A shorter, simpler, and slightly-saner interface to the Debian APT command-line
-tools.
-apt is a single command that will automatically elevate itself with sudo if
-need-be.
-It consolidates all commands from apt-get and apt-cache, and a few from
-aptitude, dpkg, dpkg-query, and apt-key, etc.
-It has a much narrower focus than similar tools such as "wajig".
+A shorter, simpler, and slightly-saner interface to the
+`Debian APT <http://en.wikipedia.org/wiki/Advanced_Packaging_Tool>`_
+command-line tools.
+
+``apt`` may be thought of as a traffic cop
+that directs commands to the appropriate tool,
+automatically elevating itself with sudo if need-be.
+It consolidates all commands from ``apt-get`` and ``apt-cache``,
+and the most common from
+``aptitude, dpkg, dpkg-query, add-apt-repository``, and ``apt-key``, etc.
+It has a much narrower focus than "kitchen-sink" tools such as ``wajig``.
 
 Hopefully this micro-project will make your life a tiny bit easier.
 
 
 ::
 
-    apt                   # for a list of available commands
+    apt                       # for a list of available commands
+    apt addrepo ppa:who/foo
     apt search foo
     apt policy foo
     apt install foo bar
     Password:
 
-    apt rm foo            # alias
+    apt rm foo                # an alias to remove
     apt instdeb foo.deb
 
 etc.
 
     sudo apt-get clean
 
+Problem?
 ``-d`` can help by outputting debugging information such as the full
-command-line.
-
-::
+command-line::
 
     apt searchfiles /bin/less -d
 
+|
 
 License
 ~~~~~~~~~
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.