-
Notifications
You must be signed in to change notification settings - Fork 0
/
open.py
41 lines (32 loc) · 1.28 KB
/
open.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# SPDX-FileCopyrightText: 2024 Matthew J. Milner <[email protected]>
# SPDX-License-Identifier: BSD-3-Clause
"""Provide a link to the location in the file system of the most recent calculation."""
import argparse
import json
import platform
import subprocess
from support import easyxtb
if __name__ == "__main__":
parser = argparse.ArgumentParser()
parser.add_argument("--debug", action="store_true")
parser.add_argument("--print-options", action="store_true")
parser.add_argument("--run-command", action="store_true")
parser.add_argument("--display-name", action="store_true")
parser.add_argument("--lang", nargs="?", default="en")
parser.add_argument("--menu-path", action="store_true")
args = parser.parse_args()
if args.print_options:
options = {}
print(json.dumps(options))
if args.display_name:
print("Go to Calculation Files")
if args.menu_path:
print("Extensions|Semi-empirical (xtb){340}")
if args.run_command:
# Have to detect os
if platform.system() == "Windows":
subprocess.run(["start", easyxtb.CALC_DIR])
elif platform.system() == "Darwin":
subprocess.run(["open", easyxtb.CALC_DIR])
else:
subprocess.run(["xdg-open", easyxtb.CALC_DIR])