@: added external-init command

@lmartinking

Here's a clean topic branch for adding new command "external-init". Feel free to add it as you please in your own time.

Thanks,
icasimpan
Hi,

The reason I used $origin is that, I intend to be able to say:
  @ external-init ./external-path/dir1/dir2/mytoyfunction

If I would use $name, external-init will get confused...so for me, this is
a straightforward decision.

As for $name, its only use is to replace "external-skel" with its value.


On Thu, Aug 21, 2014 at 1:42 PM, Lucas Martin-King <notifications@github.com
> wrote:

> In @:
>
> > + [[ -f $origin ]] && origin=$( readlink -f $origin )
> > + name=$( basename $origin )
> > +
> > + echo $name
> > +
> > + [[ -e $origin ]] && die "An external already exist by that name"
> > +
> > + cat > $origin <<EOF
> > +  # @
> > +  # |external-skel||describe what external-skel do|
> > +  _external-skel () {
> > +   echo "body of external-skel here"
> > +  }
> > +EOF
> > +
> > + sed -i "s/external-skel/$name/g" $origin
>
> Why not reference "$name" in there here-doc? eg:
>
> cat > Foo <<EOF
> Home dir is $HOME
> EOF
>
> —
> Reply to this email directly or view it on GitHub
> <https://github.com/lmartinking/monkey-tail/pull/4/files#r16521428>.
>



-- 
Ismael Angelo A. Casimpan Jr.
ismael.angelo@casimpan.com