Skip to content

Commit

Permalink
fix: Don't print message in open in headless mode (#247)
Browse files Browse the repository at this point in the history
  • Loading branch information
pederhan authored Nov 6, 2024
1 parent 09a2fab commit f493ba3
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
1 change: 0 additions & 1 deletion zabbix_cli/commands/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,6 @@ def open_config_dir(
print_path(directory)
else:
open_directory(directory, command=open_command, force=force)
success(f"Opened {directory}")


@app.command("debug", hidden=True, rich_help_panel=HELP_PANEL)
Expand Down
10 changes: 5 additions & 5 deletions zabbix_cli/utils/fs.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
from zabbix_cli.exceptions import ZabbixCLIError
from zabbix_cli.exceptions import ZabbixCLIFileError
from zabbix_cli.exceptions import ZabbixCLIFileNotFoundError
from zabbix_cli.output.console import print_path
from zabbix_cli.output.console import success

logger = logging.getLogger(__name__)

Expand Down Expand Up @@ -59,13 +61,11 @@ def open_directory(
elif sys.platform == "darwin":
subprocess.run([command or "open", spath])
else: # Linux and Unix
if not os.environ.get("DISPLAY"):
from zabbix_cli.output.console import print_path

if not os.environ.get("DISPLAY") and not force:
print_path(directory)
if not force:
return
return
subprocess.run([command or "xdg-open", spath])
success(f"Opened {directory}")


def mkdir_if_not_exists(path: Path) -> None:
Expand Down

0 comments on commit f493ba3

Please sign in to comment.