matchai / spacefish

🚀🐟 The fish shell prompt for astronauts
https://spacefish.matchai.dev
MIT License
963 stars 77 forks source link

Show Julia prompt only for project directories #202

Closed tomyun closed 4 years ago

tomyun commented 4 years ago

Description

Show Julia versions only for Julia-specific folders (i.e. containing Project.toml or JuliaProject.toml)

Motivation and Context

Julia packages use convention that the name of package root directory ends with .jl which can confuse spadefish to incorrectly show Julia prompt for regular directories.

For example, if you had a plain directory (i.e. ./project) containing a mixed bag of projects and one happened to be a Julia package (i.e. ./project/MyPackage.jl, then your prompt on ./project would display Julia version even though it's not meant.

This patch tries to fix this issue by only showing Julia prompt for those projects containing Project files. It will adversely not display Julia prompt on directories only containing plain Julia source files (*.jl). It'd be nice if there's a simple pure fish way to count only files, not directories ending with .jl.

Types of changes

Screenshots (if appropriate):

How Has This Been Tested?

Checklist:

matchai commented 4 years ago

Hi @tomyun! Thank you for opening a PR. 😄

Spacefish aims to achieve feature-parity with spaceship-prompt, the original prompt that this is a port of. I suggest new feature proposals be made at the spaceship repo, so that we can port it to spacefish when it gets approved.

That said, this will certainly be considered as we develop Julia project support into https://github.com/starship/starship, the successor and next-generation iteration for spacefish.

tomyun commented 4 years ago

Actually, spaceship-prompt has better handing of .jl extension with zsh glob qualifier ([[ -n *.jl(#qN^/) ]]) that doesn't suffer from the problem I described.

For handling of Project.toml, they have an open issue and PR for that: denysdovhan/spaceship-prompt#678 denysdovhan/spaceship-prompt#679