Skip to content

Commit

Permalink
feat: Remove source/posts/layouts flags
Browse files Browse the repository at this point in the history
The main use cases for flags that mirror the config file
- One-off overriding.  The local setup might be different than the
  deployed.  This is more for cases like `dest`.  For the flags being
  removed, I cannot see why someone would need to override these config
  settings.
- No config file.  This just seems error prone.  I don't think this is a
  use case we are aiming to support.

So why remove?
- Less to test
- Less semantics to worry about defining.  Should these be relative to
  the config file, CWD, etc?

This is a step towards #284

BREAKING CHANGE: --source, --posts, --layouts flags have been removed.
  • Loading branch information
epage committed Oct 22, 2017
1 parent 4e96a1f commit 70b549d
Showing 1 changed file with 0 additions and 39 deletions.
39 changes: 0 additions & 39 deletions src/bin/cobalt/main.rs
Expand Up @@ -97,34 +97,13 @@ fn run() -> Result<()> {
.help("Config file to use [default: .cobalt.yml]")
.global(true)
.takes_value(true))
.arg(Arg::with_name("source")
.short("s")
.long("source")
.value_name("DIR")
.help("Source folder [default: ./]")
.global(true)
.takes_value(true))
.arg(Arg::with_name("destination")
.short("d")
.long("destination")
.value_name("DIR")
.help("Destination folder [default: ./]")
.global(true)
.takes_value(true))
.arg(Arg::with_name("layouts")
.short("l")
.long("layouts")
.value_name("DIR")
.help("Layout templates folder [default: ./_layouts]")
.global(true)
.takes_value(true))
.arg(Arg::with_name("posts")
.short("p")
.long("posts")
.value_name("DIR")
.help("Posts folder [default: ./posts]")
.global(true)
.takes_value(true))
.arg(Arg::with_name("drafts")
.long("drafts")
.help("Include drafts.")
Expand Down Expand Up @@ -293,30 +272,12 @@ fn run() -> Result<()> {
Config::from_cwd(cwd)?
};

config.source = matches
.value_of("source")
.or_else(|| global_matches.value_of("source"))
.map(str::to_string)
.unwrap_or(config.source);

config.dest = matches
.value_of("destination")
.or_else(|| global_matches.value_of("destination"))
.map(str::to_string)
.unwrap_or(config.dest);

config.layouts = matches
.value_of("layouts")
.or_else(|| global_matches.value_of("layouts"))
.map(str::to_string)
.unwrap_or(config.layouts);

config.posts = matches
.value_of("posts")
.or_else(|| global_matches.value_of("posts"))
.map(str::to_string)
.unwrap_or(config.posts);

config.include_drafts = matches.is_present("drafts");

if global_matches.is_present("dump") {
Expand Down

0 comments on commit 70b549d

Please sign in to comment.