[RFR] Graceful relative paths in CLI and config file - #364
Conversation
If no `dest` is passed, docopt would still force it to `sassdoc` and the rest of the code would think `dest` was set explicitely via CLI, thus overriding any `dest` from potential configuration file.
There was a problem hiding this comment.
Why did you remove the default value here?
There was a problem hiding this comment.
See commit message and Slack discussion; it was overriding any config-defined dest even if not explicitely given via CLI.
There was a problem hiding this comment.
I find the keys destName and themeName a bit confusing, since they are actually paths. (relative but still).
There was a problem hiding this comment.
You're right, though themeName can also be the package name (not path)… and it's used only for display.
We could call them destPath and themePath but it would not be relevant for theme in the case of a non-path package name.
I'm thinking the most correct way would be to rename them in displayDest and displayTheme.
But themeName was already present in the interface, I don't think it's documented though, so we can consider it private and might rename it without "breaking".
There was a problem hiding this comment.
Then yeah, either displayDest and displayTheme.
Or maybe a method display() which could be used like env.display('themeName') ?
There was a problem hiding this comment.
You mean env.display('theme')? Not possible since the display value for the theme is figured out at the same time as theme, depending if it's a package or a path. Or env.display() would just be a proxy to the env.displayTheme variable.
There was a problem hiding this comment.
Let's keep it the simpler and DRY possible :-)
Before this, `dest` was always relative to CWD even when set from config file, and if a config file was defined, `theme` was always relative to it even when set via CLI. Now for all CLI-passed environment properties, a "friend" `*Cli` prperty is set to `true` (`themeCli`, `destCli`), so the environment loader can determine whether it's relative to CWD or config file. Also paths are now stored absolute, but are always displayed relative to the CWD for coherent CLI output. If you set `theme: ../../theme` in `foo/config.yml`, the displayed theme in CLI output will be `../theme`. This fixes #362.
15d607b to
c47dea1
Compare
This needs to be merged with
--no-ffin bothmasteranddevelopafter review. Thenmake publishon master.