#!/usr/bin/env zsh

source $dots <<- usage
  usage: dots fu add <name>
  
  options:
    
    -h,--help                   display this message
    -i,--issue   <string>       issue to use for commit message

  description:

    Save a command from history as a quick and dirty program. Creates a program
    that named $name from the command in the history $number.
usage

zparseopts -D -- -help=usage h=usage \
                 -issue:=issue i:=issue

[ -z "$usage" ] || usage
name=$1
[ ! -z "$name" ] || usage

command=`head -n 1 | sed 's/ *[0-9][0-9]* *//'`

echo "$name $command" >> ~/git/.dotfiles-fu

#!/usr/bin/env zsh

source $dots <<- usage
  usage: dots fu add <name> <number>
  
  options:
    
    -h,--help                   display this message
    -i,--issue   <string>       issue to use for commit message

  description:

    Save a command from history as a quick and dirty program. Creates a program
    that named $name from the command in the history $number.
usage

zparseopts -D -- -help=usage h=usage \
                 -issue:=issue i:=issue

[ -z "$usage" ] || usage
name=$1
number=$2
[ ! -z "$name" ] && [ ! -z "$number" ] || usage

export HISTFILE=~/.zsh_history 
fc -R
command=$(fc -l $number $number)
[[ $command =~ ' *[0-9]+ +(.*)' ]] && command=$match[1]
echo "$name $command" >> ~/git/.dotfiles-fu

--- 
+++ 
@@ -1,7 +1,7 @@
 #!/usr/bin/env zsh
 
 source $dots <<- usage
-  usage: dots fu add <name>
+  usage: dots fu add <name> <number>
   
   options:
     
@@ -19,8 +19,11 @@
 
 [ -z "$usage" ] || usage
 name=$1
-[ ! -z "$name" ] || usage
+number=$2
+[ ! -z "$name" ] && [ ! -z "$number" ] || usage
 
-command=`head -n 1 | sed 's/ *[0-9][0-9]* *//'`
-
+export HISTFILE=~/.zsh_history 
+fc -R
+command=$(fc -l $number $number)
+[[ $command =~ ' *[0-9]+ +(.*)' ]] && command=$match[1]
 echo "$name $command" >> ~/git/.dotfiles-fu
Add command line fu from stdin.
