Commits

Steve Losh  committed cf94e7b

Halp.

  • Participants
  • Parent commits bfd63ce

Comments (0)

Files changed (3)

File core/core.fish

     echo
 end
 
+function _tacklebox_help_contents
+    printf "tacklebox/%s/%s\n\n" $argv[1] $argv[2]
+    echo (functions $argv | strip | head -1 | sed -e 's/.*--description //' | strip | strip_quotes | strip )
+end
+
+function _tacklebox_help_plugin
+    if not contains $argv[1] (ls $_tb/plugins)
+        printf "Unknown plugin '%s'\n" $argv[1] >&2
+        return 1
+    else
+        if test (count $argv) -gt 1
+            _tacklebox_help_contents $argv
+        else
+            set -l plugin_help $_tb/plugins/$argv[1]/help.txt
+            if test -f $plugin_help
+                printf "tacklebox/%s\n\n" $argv[1]
+                cat $plugin_help
+                printf "\nRun 'tacklebox help %s ITEM' for more information about an item.\n" $argv[1]
+            else
+                echo "Sorry, no help is available for the" $argv[1] "plugin." >&2
+                return 1
+            end
+        end
+    end
+end
 function _tacklebox_help
     if test (count $argv) -eq 0
         _tacklebox_help_generic
         return
     end
 
-    if not contains $argv[1] (ls $_tb/plugins)
-        printf "Unknown plugin '%s'\n" $argv[1] >&2
-        return 1
-    else
-        echo HALP
-    end
+    _tacklebox_help_plugin $argv
 end
 
 function tacklebox

File plugins/misc/misc.fish

         echo $argv | strip
     end
 end
+
+function strip_quotes -d "Strip single and double from around the arguments or stdin."
+    if test (count $argv) -eq 0
+        python -c 'import sys; sys.stdout.write(sys.stdin.read().strip("\"\'"))'
+    else
+        echo $argv | strip_quotes
+    end
+end

File plugins/python/help.txt

+Various tools to make working with Python easier.
+
+Contents
+
+    cdp  Change directory to the location of the specified Python module.
+    wo   Work on a virtualenv specified in a file or an argument.