Skip to content

FEATURE: allow to pass paths from outside without searching in them #7

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

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

amtoine
Copy link
Contributor

@amtoine amtoine commented Jun 18, 2023

related to

this PR allows to pass directories from outside of the sessionizer without searching recursively in them.
the zellij-sessionizer.nu script also supports passing a --depth: int to recursively search inside the ...paths at the given depth 👌

hopefully this brings best of both worlds 😌 🤞

amtoine added 5 commits June 18, 2023 12:06
- checks if there is at least one path
- gives a nice fuzzy menu with only the names of the projects and then
  use the internally stored absolute path to reconstruct the full
  directory path
- uses the `input list --fuzzy` command of Nushell
this allows to both
- give a list of pre-computed paths to the *sessionizer*
- give a list of start directory to search recursively in them at some
  depth
@amtoine amtoine marked this pull request as ready for review June 18, 2023 10:36
amtoine added a commit to amtoine/dotfiles that referenced this pull request Jun 19, 2023
Comment on lines +13 to +16
# open a session in local repos and documents
# > zellij-sessionizer.nu (
# > [~/.local/share/repos/ ~/documents/] | each { ls $in | where type == dir | get name } | flatten
# > )
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi, Sorry for my absence!

isn't it the same as:

zellij-sessionizer $( fd . ~/Documents --type d) # Then it just gets piped into fzf?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi, Sorry for my absence!

hey 👋
no worries 😉

isn't it the same as:

zellij-sessionizer $( fd . ~/Documents --type d) # Then it just gets piped into fzf?

yeah it looks about the same 👍
i'm just using pure Nushell commands but they are looking for depth-1 directories in all the directories in the list to the left 😋

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right!
So I'd probably add it as part of the alias (we can update the readme for it) instead of pushing it into the code as it feels like something some users would like where others would defer to an external app (such as fd)

WDYT?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right! So I'd probably add it as part of the alias (we can update the readme for it) instead of pushing it into the code as it feels like something some users would like where others would defer to an external app (such as fd)

WDYT?

not sure i see what you mean here by "add it as part of the alias instead of pushing it into the code" 😕

and you're talking about the Bash implementation, right?

Copy link
Owner

@silicakes silicakes Jul 16, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add it as part of the alias instead of pushing it into the code

I mean that I think it should be part of the users config - like a parameter passed to their .rc aliases for zellij-sessionizer

I'm talking about both implementations as I try to maintain a single-responsibility philosophy as much as possible.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok i see, does that mean that you'd like the script not mentioning find or fd directly?

i might miss something here 😱 😆

Copy link
Owner

@silicakes silicakes Jul 16, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes!
give it some sane defaults and let the user decide about everything that's under the title of 'customization'

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ooh yeah, i see what you mean now 😌

i'd say, as find and fd were already there before this PR, we can leave this as-is for now and tackle the removal of these commands and making them configurable in another PR? 😋

Copy link
Owner

@silicakes silicakes Jul 18, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So the solution I was thinking about is sort of a flat way of passing params into your find cmd, without explicitly mentioning it within the code.

Assuming you're using fd - I envision something like

$ zellij_sessionizer [paths] -- ...rest_of_fds options

Then the script will just pass it as is.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mm we can't do that really in Nushell right now 😕

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants