Closed delphidabbler closed 2 years ago
One possible solution would be to have a separate program config file, say pashi.config
or run.dat
, that PasHi uses to store the name & location of the current config file.
An option such as --use-config-file <filename>
could then write the name of the required config file to the run.dat
file. Every time PasHi ran it would read run.dat
to determine which config file to use.
This would also fix the concerns about the proposed --options
command. That command would always act on the current config file.
Of course, the use-config-file
command would have to be blacklisted for use in config files and would need to be the only command on the command line.
Maybe there should also be a matching command to restore the default config file, say --restore-default-config
Trying to decide whether to implement in v2.x or leave for v3.
If the run.dat
file is to be in the same folder as a user defined config file we need to avoid name clashes.
So maybe name the file with a GUID.
So maybe name the file with a GUID.
Alternatively insist that user config files are either named config
or have a required specific extension, say .config
or .user
.
Of course not only must there be no name clash with the run.dat
kind of file, there mustn't be a clash with any other file (e.g. .css
).
Maybe there should also be a matching command to restore the default config file, say
--restore-default-config
Instead of a special --restore-default-config
command a version of --use-config-file
with the special -
parameter could be used, i.e. --use-config-file -
.
💡 Maybe extend the idea of using the special -
option to restore some other command defaults too?
So maybe name the file with a GUID.
Alternatively insist that user config files are either named
config
or have a required specific extension, say.config
or.user
.Of course not only must there be no name clash with the
run.dat
kind of file, there mustn't be a clash with any other file (e.g..css
).
Another solution would be to require the user to provide only a base name then add a suitable extension. E.g. user does --use-config-file mycfg
and PasHi would then use mycfg.config
. If user does provide an extension it could either be stripped and replaced or the .config
could be appended.
PasHi could output the full name & path of the config file & whether it already exists. It could also output the command required to restore the default file. E.g., for the command:
PasHi --use-config-file c:\settings\mycfg
PasHi would output something like
Now using config file: c:\settings\mycfg.config
File doesn't exist ... creating empty file. Please edit.
To restore default config file, use `PasHi --use-config-file -`
If the config file already existed then the 2nd line of output would be omitted.
If the restore-default-config
(or similar) option was used then output could be:
Restored default config file
So maybe name the file with a GUID.
Alternatively insist that user config files are either named
config
or have a required specific extension, say.config
or.user
. Of course not only must there be no name clash with therun.dat
kind of file, there mustn't be a clash with any other file (e.g..css
).Another solution would be to require the user to provide only a base name then add a suitable extension. E.g. user does
--use-config-file mycfg
and PasHi would then usemycfg.config
. If user does provide an extension it could either be stripped and replaced or the.config
could be appended.
Rather than have a convoluted rule for user config files, could the run.dat
file be stored in a special (hidden?) subdirectory of %AppData%
, say .pashi
, that the user is not allowed to access?
This functionality is now to be I corporated in the new --config
being proposed in issue #2.
So this issue is being closed as it now duplicates some of issue #2.
It may be useful to have several predetermined configurations of PasHi, when it is being used for various reasons.
An option to use something other than the default
config
file would be useful in those circumstances.BUT this would make the proposed
--options
command more complex - see issue #2.