Use of a configuration file #27
CharlesGodwin
started this conversation in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
When starting a tool from the command line or in a shell script the need to define all options and then enter them can be problematic. A common solution is to create a configuration fie with all the settings defined. I have studied the possible solutions available and think I have a workable solution.
My choices where:
DEVICE="/dev/ttyUSB0"
and then run this file as you execute the command. This failed for these reasons.I had decided on the following:
Use the optional file parameter built into python's argparse tool. The programs are all ready using this tool to parse the command line options so it's easy to create an options file, containing lines similar to the command line and direct the program to use it. For example
magdump @pymagnum.opt
would invokemagdump
and the options would be read from a file namedpymagnum.opt
. Here is what a default option file would look like. The # character is the beginning of a comment and are stripped.This solution is being prepared for use in version 2.0 unless I get convincing feedback
Beta Was this translation helpful? Give feedback.
All reactions