metanorma / metanorma-cli

CLI (Command Line Interface) for Metanorma
BSD 2-Clause "Simplified" License
5 stars 5 forks source link

Command `metanorma new` #13

Closed ronaldtse closed 5 years ago

ronaldtse commented 5 years ago

We need a command to generate a new skeleton for a new Metanorma document.

This is similar to the bundle gem and rails new commands. We want to generate a new Metanorma document skeleton, perhaps we can use git to download the skeleton (or include it in the gem).

The files that are necessary are:

and?

ronaldtse commented 5 years ago

ping @opoudjis @strogonoff

strogonoff commented 5 years ago

This would be awesome and simplify the quickstart a lot.

The exact templates to be used for generation could be provided by specific gems (e.g. Metanorma-ISO); Metanorma-CLI can depend on them and complain if e.g. you try to metanorma new --class iso without having metanorma-iso installed, although it’s not up to me how it’s done better.

Alternatives: metanorma init

IMO metanorma build is not the best as it hints at rendering final documents.

opoudjis commented 5 years ago

No, I have no idea what you're asking for, and I don't see the point of it.

In fact, the only thing I see here being of any generalisable use is the index.doc skeleton. And we already have several of those.

strogonoff commented 5 years ago

Not my idea but I still like it.

I agree that Github/Travis stuff could only prompt more confusion for some users, deploy.sh is hard to generalize, and I have no comment about Metanorma project file layout.

What do you think of just bundling just the Makefile / Gemfile / index.adoc as an easy installable skeleton @opoudjis?

And we already have several of those.

Let’s say I’m an ISO author, how do I use one now? Sorry if it’s a silly/straightforward question

opoudjis commented 5 years ago

Grab an existing document, like the Rice document, and replace its contents. This doesn't deserve any more work than that.

I've assigned myself this task, but I'm assigning it back to you and Ronald, because I know nothing about the workflow that it presupposes, and there is not enough here for me to work on otherwise.

strogonoff commented 5 years ago

The skeleton model makes sense overall. I believe that’s the way create-react-app worked originally, for example. (That said I just discovered that in latest versions they seem to have switched to a model where the user runs a “create” command to create app skeleton.)

ronaldtse commented 5 years ago

@strogonoff and that's why we prefer a "metanorma create" command 👍

ronaldtse commented 5 years ago

I do agree now with @opoudjis that we don't want to split the sections. But the rest of the files are useful.

ronaldtse commented 5 years ago

So:

metanorma new -t iso my-doc-name
# => new directory `my-doc-name/` gets created with ISO document template
metanorma new -t iso my-doc-name --split-sections
# => new directory `my-doc-name/` gets created with ISO document template with split sections

The template will be downloaded from a place like:

(OGC already keeps separate templates for different document types)

ronaldtse commented 5 years ago

(@opoudjis NIST has requested to provide split sections in a template 😉 )

opoudjis commented 5 years ago

I find this predilection for split sections bizarre: given how pervasive cross-referencing is, having to skip between documents during authoring seems to me utterly counterproductive. But there's no accounting for taste. :-)

ronaldtse commented 5 years ago

It’s a matter of the text editor. If you find changing tabs better than scrolling, split files is easier (to me). If you like scrolling, a single file is easier.

I generally use editors that have good tab support, so I prefer split files (unless the document is short).

ronaldtse commented 5 years ago

And this is the related OGC task: https://github.com/metanorma/metanorma-ogc/issues/23

abunashir commented 5 years ago

@ronaldtse: Let me try to summarize what do we need for this, I'm taking iso as an example.

Question:

cc: @opoudjis

ronaldtse commented 5 years ago

@abunashir going to push the templates in a few minutes 😉

It will be at https://github.com/metanorma/mn-templates-csd/

ronaldtse commented 5 years ago

@abunashir just for the record.

We will start off the first iteration by creating a separate script called metanorma-new in exe/.

The CSD template repository of https://github.com/metanorma/mn-templates-csd is already done (mostly) and up.

The command is metanorma-new -t {type} -d {doctype} [my-new-document-name]

In the future:

  1. The command (in the future) can use a git template repo.
  2. Users can use their own git template repo
ronaldtse commented 5 years ago

This is being done in #35

ronaldtse commented 5 years ago

35 is done and merged (pending #45). Closing this now.