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

add: make shell command configurable #458

Merged
merged 5 commits into from
Sep 29, 2023
Merged

Conversation

Nukesor
Copy link
Owner

@Nukesor Nukesor commented Aug 18, 2023

Fixes #454
Fixes #363

This is waiting for some people to actually test this.

I would like to see some tests for:

  • Bash
  • Zsh ( if it's possible)
  • Oilshell
  • Fish
  • Nushell
  • Powershell

However, the more the merrier.

How to test:

cd /tmp
git clone [email protected]:nukesor/pueue
cd pueue
git switch configurable-shell
cargo install --path pueue

For bash, add this to your daemon settings section:

  shell_command: [
    "bash",
    "-c",
    "shopt -s expand_aliases && {{ pueue_command_string }}",
  ]
  env_vars:
    BASH_ENV: "/path/to/aliases_file"

For zsh, add this:

  shell_command: [
    "zsh",
    "-c",
    ". /path/to/aliases_file; setopt aliases; eval {{ pueue_command_string }}",
  ]

Make sure to restart your daemon!

@Nukesor Nukesor added t: Feature A new feature that needs implementation s: Pueue-lib This issue touches the pueue-lib library s: Daemon This issue touches pueue daemon labels Aug 18, 2023
@Nukesor Nukesor self-assigned this Aug 18, 2023
@github-actions
Copy link

github-actions bot commented Aug 18, 2023

Test Results

    3 files  ±0    22 suites  ±0   3m 46s ⏱️ +51s
143 tests ±0  143 ✔️ ±0  0 💤 ±0  0 ±0 
306 runs  ±0  306 ✔️ ±0  0 💤 ±0  0 ±0 

Results for commit d392756. ± Comparison against base commit 1552761.

♻️ This comment has been updated with latest results.

@codecov-commenter
Copy link

codecov-commenter commented Aug 18, 2023

Codecov Report

Merging #458 (d392756) into development (1552761) will increase coverage by 0.35%.
The diff coverage is 94.48%.

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

@@               Coverage Diff               @@
##           development     #458      +/-   ##
===============================================
+ Coverage        79.44%   79.80%   +0.35%     
===============================================
  Files               77       77              
  Lines             5444     5511      +67     
===============================================
+ Hits              4325     4398      +73     
+ Misses            1119     1113       -6     
Files Coverage Δ
pueue/src/bin/pueue.rs 66.66% <ø> (+5.37%) ⬆️
pueue/src/client/client.rs 60.10% <100.00%> (+0.96%) ⬆️
pueue/src/client/commands/edit.rs 97.34% <100.00%> (+0.07%) ⬆️
pueue/src/client/commands/restart.rs 75.92% <100.00%> (+0.45%) ⬆️
pueue/src/daemon/mod.rs 69.69% <ø> (+2.07%) ⬆️
pueue/src/daemon/task_handler/spawn_task.rs 90.29% <100.00%> (+1.49%) ⬆️
pueue_lib/src/settings.rs 72.94% <100.00%> (+2.73%) ⬆️
pueue/src/daemon/task_handler/callback.rs 11.49% <0.00%> (ø)
pueue_lib/src/process_helper/unix.rs 94.08% <96.00%> (-0.26%) ⬇️
pueue_lib/src/process_helper/mod.rs 73.07% <86.84%> (+37.36%) ⬆️

@Nukesor Nukesor force-pushed the configurable-shell branch 6 times, most recently from b6f16c9 to ea56a06 Compare August 20, 2023 21:39
@Nukesor Nukesor changed the base branch from main to development August 21, 2023 18:17
@Nukesor Nukesor force-pushed the configurable-shell branch 2 times, most recently from 6ab7efa to 58282c9 Compare August 21, 2023 21:12
@Nukesor Nukesor mentioned this pull request Aug 21, 2023
@Nukesor Nukesor force-pushed the configurable-shell branch 4 times, most recently from f9355e2 to c64aec9 Compare August 21, 2023 22:32
@Nukesor Nukesor mentioned this pull request Aug 23, 2023
@isti115
Copy link

isti115 commented Sep 5, 2023

Thanks for taking the effort to support multiple shells!

I have managed to get my Nushell (nu) definitions working with this configuration:

  shell_command: [
    "nu",
    "--env-config ~/.config/nushell/env.nu",
    "--config ~/.config/nushell/config.nu",
    "-c",
    "{{ pueue_command_string }}"
  ]

I also tested PowerShell Core (pwsh), which works without any extra flags, seemingly the profile gets loaded into non-interactive sessions by default:

  shell_command: [
    "pwsh",
    "-c",
    "{{ pueue_command_string }}"
  ]

@WindSoilder
Copy link

Sorry for late reply, I've tried in nushell recently, and verified it works too

@Nukesor
Copy link
Owner Author

Nukesor commented Sep 29, 2023

I think I'm going to merge this, It has been open for long enough and from what I can see it works quite well with various shells :)

We'll squash any upcoming bugs once the feature is released.

I'll explicitly mark this feature as experimental, since there's a lot of stuff that can go wrong with shells :D

Thanks @ everyone for helping out with testing the shells :)

@Nukesor Nukesor merged commit 96b5fef into development Sep 29, 2023
17 checks passed
@Nukesor Nukesor deleted the configurable-shell branch September 29, 2023 09:59
@jarrodu
Copy link

jarrodu commented Dec 10, 2023

Is this feature documented? I did not see it in the the Wiki. I found the config option in the config file and searched for "shell_command" here.

@Nukesor
Copy link
Owner Author

Nukesor commented Dec 11, 2023

It's not yet documented, we should add a section to the wiki 😅 eventually.

The feature was only announced in the recent changelog of https://github.com/Nukesor/pueue/releases/tag/v3.3.0
Most info about this can be found in this issue: #454

Feel free to add some docs to the wiki :) Everyone can contribute!

@v217
Copy link

v217 commented Sep 22, 2024

Hi,
Thank you for pueue!
For the fish shell, this works for me:

shell_command: [
    "fish",
    "-c",
    "{{ pueue_command_string }}"
  ]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
s: Daemon This issue touches pueue daemon s: Pueue-lib This issue touches the pueue-lib library t: Feature A new feature that needs implementation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Expand aliases
6 participants