Closed prjemian closed 3 weeks ago
Moving this to v1.0 since it might be the temporary solution for loading data from the dserv.
Related to #124
Need argument -d directory_path
, default to pwd
With commit 3a557f8:
global logger
options = command_line_interface()
logging.basicConfig(level=options.log.upper())
logger = logging.getLogger(__name__)
logger.info("Logging level: %s", options.log)
# set warning log level for (noisy) support packages
for package in "httpcore httpx PyQt5 tiled".split():
logging.getLogger(package).setLevel(logging.WARNING)
Example for directory
exists:
parser.add_argument(
"directory",
default=".",
help=(
"Directory for the new instrument."
" If omitted, use the present working directory"
f" ({pathlib.Path('.').absolute()})."
" The directory will be created if it does not exist."
" If the directory exists and it is not empty, this"
" program will stop before any action is taken."
),
nargs="?",
type=str,
)
with directory option
(bluesky_2024_2) zorinvm@zorin22:~/.../BCDA-APS/mdaviz$ mdaviz -h
usage: mdaviz [-h] [--log {critical,fatal,error,warn,warning,info,debug,notset}] [-v] [directory]
mdaviz: Python Qt5 application to visualize Bluesky data from tiled server.
positional arguments:
directory Directory for the new instrument. If omitted, use the present working directory
(/home/zorinvm/Documents/projects/BCDA-APS/mdaviz). The directory will be created if it does not
exist. If the directory exists and it is not empty, this program will stop before any action is taken.
options:
-h, --help show this help message and exit
--log {critical,fatal,error,warn,warning,info,debug,notset}
Provide logging level. Example '--log debug'. Default level: 'warning'
-v, --version show program's version number and exit
(bluesky_2024_2) zorinvm@zorin22:~/.../BCDA-APS/mdaviz$
... such as usage, help, version number, and logging level. https://github.com/BCDA-APS/mdaviz/blob/09937f4d1d31e20a44bcf57a8476c3cae909f337/mdaviz/app.py#L23-L24