-
Notifications
You must be signed in to change notification settings - Fork 335
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Generate new posts from the terminal #257
Comments
This is out of scope for wintersmith since it does not have any concept of an article. A helper script in the blog example/template could be a compromise. Something like |
I think @kirjs idea is the most convenient way to do it. Would it be possible to have "plugin commands" as in if Wintersmith receives a command it doesn't natively know it goes and looks in folder X and Y for a script with that name? That would deliver convenience and still not clutter up the Wintersmith executable with "blog-aware" commands and concepts. Example Time: |
@philg, I actually like @jnordberg intention to keep the core clean and simple. I think all the all the scaffolding functionality can be moved out to some other scaffolding tool, like a yeoman generator, that can build it's functionality on top of wintersmith. I found a https://github.com/yangpro/generator-logsmith generator, which looks like a good candidate for the task and created an issue there. |
Refs #152 |
I indeed understand the problem with adding such functionality to the core of Wintersmith too! I just think since it "advertises" itself as flexible it would make sense to allow users to easily add subcommands to argv = optimist.options(globalOptions).argv
if argv._[0]?
try
cmd = require "./#{ argv._[0] }"
catch error
if error.code is 'MODULE_NOT_FOUND'
# requiring plugin command without error checks for readability
cmd = require "#{ process.cwd() }/plugins/commands/#{ argv._[0] }"
else
throw error This is quite surely the most unelegant way to do it since nested try/catch blocks are absolutely hideous; but I think it gets the point across. Custom commands can be implemented like the builtin ones, just stored in another directory to not mess up the core functionality. Heck, you would already have examples on how to do custom commands! Something like this to keep it elegant? argv = optimist.options(globalOptions).argv
if argv._[0]?
try
cmd = require_command argv._[0]
catch error
if error.code is 'MODULE_NOT_FOUND'
console.log "'#{ argv._[0] }' - no such command"
process.exit 1
else
throw error |
Could be used like this:
wintersmith article 'Post Title'
A folder can be generated with a name post-title (some kind of a slug)
Index.md can have all default settings and current date as a date in yaml.
Would same some time on copy/paste
The text was updated successfully, but these errors were encountered: