Improve pj-plugin to support projects with spaces in their names + optimise code #1604

Merged
merged 3 commits into from Nov 6, 2014

Projects

None yet

4 participants

@franklouwers
Contributor

...depending on date format + add support for projects with spaces in them

@franklouwers franklouwers [pj-plugin] delete ugly ls -l | awk print $9 thing to use something n…
…ot depending on date format + add support for projects with spaces in them
9674a96
@franklouwers

If you want to avoid the fork + "basename", you could change this line to:

    projects+=(${i##*/})

as well.

@mcornella
Collaborator

👍 This needs testers though.

@mcornella

You can use ${i:t}. It gives the tail of the pathname. See http://bolyai.cs.elte.hu/zsh-manual/zsh_6.html#SEC37
Also, I'm pretty sure I saw a way to apply that to all the elements of the array, I'll look into it.

Yeah, it's just the same, so you could do:

projects=($PROJECT_PATHS/*)
projects=$projects:t  # or ${projects:t} if you prefer
@mcornella
Collaborator

Hi @franklouwers, can you shorten the title and update according to my suggestions?

@franklouwers franklouwers changed the title from Improve pj-plugin to support projects with spaces in their names + stop depending on ls -l output format by killing the ls -l | awk print $9 construction. to Improve pj-plugin to support projects with spaces in their names + optimise code May 28, 2014
@franklouwers
Contributor

@mcornella done. thanks for suggestion. Sorry it took a while, old merge request, needed to re-orient myself :)

@mcornella
Collaborator

Uff.. This has been long gone unmerged now, sorry for the long wait @franklouwers

/cc @robbyrussell ready to merge, tested by me 👍

@robbyrussell robbyrussell merged commit ed01122 into robbyrussell:master Nov 6, 2014
@alfss
Contributor

This not work on mac (OS X 10.10).
when pressing tab I get: "project1\ project2\ pro-ject3\ project4"

this code work fine:

foreach i ($PROJECT_PATHS/*)
do
    projects+=(${i##*/})
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment