【发布时间】:2022-09-29 20:35:32
【问题描述】:
我在 python 脚本中使用 click 并尝试在 shell 中运行它。完整的命令如下所示。
python3 test.py --include_dirs ${include_dirs} --excludes ${exclude_models} --calibration_type ${calibration_type} --per_channel ${per_channel} --optional_test ${test1}
由于用户可能不会给出所有选项,因此以这种方式编写脚本会导致问题。例如,如果include_dirs 变量未设置,则\'--excludes\' 将是--include_dirs 选项的输入。
所以我想知道是否有一种优雅的方法来解决它。我可以为这些选项提供空输入吗?