From 7ede21e362b12829b74ed8c40f466267f656503f Mon Sep 17 00:00:00 2001 From: Sagi Dayan Date: Thu, 25 Nov 2021 12:59:22 +0200 Subject: [PATCH] When using flatpak. Add open function to CLI. Will open Junction (Flatpak) to select applications --- roles/flatpaks/tasks/main.yml | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/roles/flatpaks/tasks/main.yml b/roles/flatpaks/tasks/main.yml index 654f8be..635da78 100644 --- a/roles/flatpaks/tasks/main.yml +++ b/roles/flatpaks/tasks/main.yml @@ -22,3 +22,16 @@ - re.sonny.Junction - org.gnome.DejaDup state: present + +- name: Check if open function is set + shell: grep -c "^function open" ~/.shellconfig/functions.sh || true + register: open_test + +- name: "Adding 'open' shell function" + ansible.builtin.lineinfile: + name: ~/.shellconfig/functions.sh + line: | + # Open files from CLI via Junction flatpak + function open() { if [[ -f $@ || -d $@ ]]; then flatpak run re.sonny.Junction $@ &>/dev/null; else echo "❌No such file or directory '$@'"; false; fi} + state: present + when: open_test.stdout|int == 0