Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Configurable hostname #21

Merged
merged 1 commit into from
Sep 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading