Skip to content

Commit

Permalink
Configurable hostname (#21)
Browse files Browse the repository at this point in the history
  • Loading branch information
Yethal authored Sep 12, 2024
1 parent de377b4 commit 03a0720
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 1 deletion.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ For more information about variables marked with an asterisk please read the Cav
| disable_banner | whether built-in nushell banner should be disabled | false |
| nu_users | List of users for which config and plugins should be registered | [] |
| add_hostname_to_prompt | Whether inventory hostname should be added to default prompt | false |
| nu_hostname | Hostname to add to prompt if `add_hostname_to_prompt` is true | inventory_hostname |
| clear_login_file | Whether login.nu should be cleared of all non-commented lines | false |

## Plugin installation
Expand Down
1 change: 1 addition & 0 deletions defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ install_plugins: true
install_configs: remote
overwrite_configs: false
add_hostname_to_prompt: false
nu_hostname: "{{ inventory_hostname }}"
clear_login_file: false
nu_plugins:
- nu_plugin_custom_values
Expand Down
2 changes: 1 addition & 1 deletion tasks/configs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@
ansible.builtin.lineinfile:
path: "{{ item.homedir }}/{{ nushell_config_path }}/env.nu"
regexp: "^.*PROMPT_INDICATOR.*$"
line: "{{ '$env.' if _nushell_version is version('0.83.0', '>=') else 'let-env ' }}PROMPT_INDICATOR = '({{ inventory_hostname }})〉'"
line: "{{ '$env.' if _nushell_version is version('0.83.0', '>=') else 'let-env ' }}PROMPT_INDICATOR = '({{ nu_hostname }})〉'"
validate: "{{ nushell_binary_path }}/nu -n -c 'source %s; $env'"
when: add_hostname_to_prompt|bool
loop: "{{ home_dirs }}"
Expand Down

0 comments on commit 03a0720

Please sign in to comment.