Gastove / doctopus

An un-opinionated framework for Docs on the Webs
Eclipse Public License 1.0
7 stars 2 forks source link

Augment shell command functionality #22

Closed Gastove closed 9 years ago

Gastove commented 9 years ago

At present, the "command" used by a tentacle is stored as a vector of pieces, with the "command" separate, like so:

{:html-command "lein"
 :html-args ["marg" "-f" "index.html"]}

There's a couple problems with this:

  1. It's a little baffling for a human to write, and easy to get wrong.
  2. We cannot support html projects with more than one build step.

    Proposal

Re-tool to using a single vector-of-vectors, like so:

:html-command [["lein marg -f index.html"]]

A command with more-than-one step could go:

:html-command [["npm -i"]
                           ["node bin/mop.js"]]

In the backend, we need to implement command splitting and chaining -- that is, each command-vector needs to be converted to a vector of words.

jarofghosts commented 9 years ago

We also need a way to denote special words that can be filled into the commands, environment vars maybe?

Gastove commented 9 years ago

AH, right. Right right right. For instance:

: html-command [["make-some-html --basepath :url-root
jarofghosts commented 9 years ago

i feel like we need something that isn't going to collide with possibly valid command syntax, which is why using environment vars and their syntax seemed to make sense. there may be a better solution, though

Gastove commented 9 years ago

Yeah. I agree about collisions -- which is part of why I suggested keywords (like :url-root). That said, I think usability is the most important part, since the server can accommodate whatever, and the syntax of env-vars is pretty well understood.

I think, as long as we can provide some guidance in the create/edit web view about how to write a correct command, we should be OK.

Will do a pass on the server parts of this later today.