1
0
Fork 0

Compare commits

..

No commits in common. "d77b4f05c3e560905df781ce6e0d4644ebcdb00a" and "d267901ad817e1fe9f0fa4a1dbdbbe447d0f2ef0" have entirely different histories.

2 changed files with 4 additions and 32 deletions

11
bang.py
View file

@ -153,18 +153,15 @@ def main():
exit("Bad Rofi output.") exit("Bad Rofi output.")
handle = parts[0] handle = parts[0]
query = None
if handle not in handles and (default_handle := args.default): if handle not in handles and (default_handle := args.default):
handle = default_handle handle = default_handle
if len(parts) == 1: if len(parts) == 1:
query = parts[0] queries.append(parts[0])
else: else:
query = output queries.append(output)
elif len(parts) == 2:
query = parts[1]
if query is not None: if len(parts) == 2:
queries.append(query) queries.append(parts[1])
# If no queries were obtained during options parsing, # If no queries were obtained during options parsing,
# show Rofi now to get a single query. # show Rofi now to get a single query.

View file

@ -1,25 +0,0 @@
#!/usr/bin/env python3
import argparse
import uuid
import webbrowser
OBS_URL_F = "https://openobs.mnhn.fr/redirect/sinp/occurrences/{obs_uuid}"
TEST1 = "45A202E8-A4D0-41E9-AC27-041004CB8AD0"
TEST2 = "45A202E8A4D041E9AC27041004CB8AD0"
def main():
parser = argparse.ArgumentParser()
parser.add_argument("uuid")
args = parser.parse_args()
open_uuid(args.uuid)
def open_uuid(uuid_str: str):
obs_uuid = uuid.UUID(uuid_str)
webbrowser.open_new_tab(OBS_URL_F.format(obs_uuid=str(obs_uuid)))
if __name__ == "__main__":
main()