We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents 456f97c + 55c3785 commit 7dec2c4Copy full SHA for 7dec2c4
roles/git/tasks/main.yml
@@ -56,3 +56,22 @@
56
src: git-switch-default
57
dest: /usr/local/bin/git-switch-default
58
mode: '0755'
59
+
60
+- name: Set shell info
61
+ ansible.builtin.set_fact:
62
+ shell_info: "{{ ansible_user_shell | shell_config }}"
63
64
+- name: Override default command
65
+ ansible.builtin.blockinfile:
66
+ path: "{{ ansible_user_dir }}/{{ shell_info.rc_file }}"
67
+ marker: "# {mark} ANSIBLE MANAGED BLOCK git command"
68
+ block: |
69
+ git() {
70
+ if [ "$1" = "switch" ] && [ $# -eq 1 ]; then
71
+ # git switchが引数なしで呼ばれた場合
72
+ command git switch-default
73
+ else
74
+ # 引数がある場合や他のgitサブコマンドはそのまま実行
75
+ command git "$@"
76
+ fi
77
+ }
0 commit comments