pashi
pashi copied to clipboard
Add option to nominate a default CSS file for embedding
When embedding a CSS file it's path has always to be specified, unless it is in PasHi's %AppData% directory (or in the "private" folder if issue #35 is implemented).
It would be useful to be able to nominate a given CSS file to use with a shorthand version on the --embed-css command, say --embed-css -.
The default CSS file could be set with a command such as --default-css-file <path-to-css-file>. If required CSS file was in %AppData% no path would be specified.
Of course PasHi would need a special config file to store the default CSS file path. The same run.dat file proposed in issue #23 could be used.
We would have to decide how to respond to --embed-css - if no default CSS file had been set with --default-css-file. We could either raise an exception or use a default, default CSS (!) file which would need to be one if the ones provided with an installation of PasHi. If the latter option is taken then maybe --default-css-file could use the special - option to restore the default default CSS file.
We would have to decide how to respond to
--embed-css -if no default CSS file had been set with--default-css-file. We could either raise an exception or use a default, default CSS (!) file which would need to be one if the ones provided with an installation of PasHi. If the latter option is taken then maybe--default-css-filecould use the special-option to restore the default default CSS file.
⚠️ PasHi installs have an option not to install the CSS files, so the choice to use a default default CSS file could be problematic. So, raising and exception could be the best solution to having no default CSS file set.
If the exception route is taken then using --default-css-file could with the - option could have the effect of cancelling the default CSS file setting.
Note that --default-css-file would need to be the only command on the command line - it should have its own "execution context" in v3 development speak!
default-css-file should be blacklisted for use in config files. Although it would seem to make sense at first sight to allow it, the command would cause problems because it can't be used with other command line options.
⚠️ PasHi installs have an option not to install the CSS files, so the choice to use a default default CSS file could be problematic. So, raising and exception could be the best solution to having no default CSS file set.
I'd forgotten about the existing --default-css command.
That command gets the default style sheet from resources, getting round the problem of what to do if the user doesn't install any style sheets.
So the obvious solution to the "no default set" problem is to get the default from resources.
❓ Should we now make --default-css-file affect the working of --default-css instead of --embed-css and make --embed-css - an simply alias for --default-css, or should --default-css retain its current purpose (as it must in a minor update) and make --embed-css - different?
❓ Should we now make
--default-css-fileaffect the working of--default-cssinstead of--embed-cssand make--embed-css -an simply alias for--default-css, or should--default-cssretain its current purpose (as it must in a minor update) and make--embed-css -different?
How about adding # parameter to --embed-css that embeds the default style sheet in resources? Then make --embed-css # equivalent to --default-css and deprecate --default-css? --embed-css - would then work as above with the file specified by --default-css-file
For completeness --default-css-file # could be used to make --embed-css - refer to the default CSS file in resources.
--default-css-file - would the definitely be used to forget the default CSS file and --embed-css - would have to raise an exception if used with no default style sheet being specified.
Summarising thoughts so far:
The --embed-css command should be extended to use following additional parameters:
#- embed PasHi's built in style sheet. This is the same as specifying the--default-csscommand.-- embed the style sheet specified by the--default-css-fileoption. An exception would be raised if a default style sheet had not been set or had been deleted.
There will be a new --default-css-file command that takes one of the following parameters:
<css-file-path>- use the given CSS file as the default.#- use PasHi's built in style sheet as the default.-- delete the recorded default CSS file.?- display the name of the default CSS file, if any. This one's new: not mentioned above.