spaceship-prompt 4.3.3 → 4.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +14 -0
- package/lib/utils.zsh +11 -0
- package/package.json +1 -1
- package/sections/elixir.zsh +1 -1
- package/sections/julia.zsh +1 -1
- package/sections/package.zsh +19 -1
- package/sections/php.zsh +1 -1
- package/spaceship.zsh +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
## [4.4.1](https://github.com/spaceship-prompt/spaceship-prompt/compare/v4.4.0...v4.4.1) (2022-09-21)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* fix grep unknown option: --color ([#1206](https://github.com/spaceship-prompt/spaceship-prompt/issues/1206)) ([540a17a](https://github.com/spaceship-prompt/spaceship-prompt/commit/540a17a37a2199a3faa4987564a6485b63582fef)), closes [#1066](https://github.com/spaceship-prompt/spaceship-prompt/issues/1066)
|
|
7
|
+
|
|
8
|
+
# [4.4.0](https://github.com/spaceship-prompt/spaceship-prompt/compare/v4.3.3...v4.4.0) (2022-09-21)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Features
|
|
12
|
+
|
|
13
|
+
* make package section to support maven and gradle ([#1209](https://github.com/spaceship-prompt/spaceship-prompt/issues/1209)) ([c8b6ce7](https://github.com/spaceship-prompt/spaceship-prompt/commit/c8b6ce7ade1a3176353d6ba46faa37db7e05e709))
|
|
14
|
+
|
|
1
15
|
## [4.3.3](https://github.com/spaceship-prompt/spaceship-prompt/compare/v4.3.2...v4.3.3) (2022-09-21)
|
|
2
16
|
|
|
3
17
|
|
package/lib/utils.zsh
CHANGED
|
@@ -232,3 +232,14 @@ spaceship::datafile() {
|
|
|
232
232
|
# todo: grep by regexp?
|
|
233
233
|
return 1
|
|
234
234
|
}
|
|
235
|
+
|
|
236
|
+
# grep with --color=never or not
|
|
237
|
+
# USAGE:
|
|
238
|
+
# spaceship::grep [options] [pattern] [file ...]
|
|
239
|
+
spaceship::grep() {
|
|
240
|
+
local GREP_OPTIONS=""
|
|
241
|
+
if command grep --color=never "" &>/dev/null <<< ""; then
|
|
242
|
+
GREP_OPTIONS="--color=never"
|
|
243
|
+
fi
|
|
244
|
+
command grep $GREP_OPTIONS "$@"
|
|
245
|
+
}
|
package/package.json
CHANGED
package/sections/elixir.zsh
CHANGED
|
@@ -39,7 +39,7 @@ spaceship_elixir() {
|
|
|
39
39
|
|
|
40
40
|
if [[ $elixir_version == "" ]]; then
|
|
41
41
|
spaceship::exists elixir || return
|
|
42
|
-
elixir_version=$(elixir -v 2>/dev/null | grep "Elixir"
|
|
42
|
+
elixir_version=$(elixir -v 2>/dev/null | spaceship::grep "Elixir" | cut -d ' ' -f 2)
|
|
43
43
|
fi
|
|
44
44
|
|
|
45
45
|
[[ $elixir_version == "system" ]] && return
|
package/sections/julia.zsh
CHANGED
|
@@ -29,7 +29,7 @@ spaceship_julia() {
|
|
|
29
29
|
|
|
30
30
|
spaceship::exists julia || return
|
|
31
31
|
|
|
32
|
-
local julia_version=$(julia --version | grep
|
|
32
|
+
local julia_version=$(julia --version | spaceship::grep -oE '[[:digit:]]+\.[[:digit:]]+\.[[:digit:]]')
|
|
33
33
|
|
|
34
34
|
spaceship::section \
|
|
35
35
|
--color "$SPACESHIP_JULIA_COLOR" \
|
package/sections/package.zsh
CHANGED
|
@@ -22,7 +22,7 @@ SPACESHIP_PACKAGE_SYMBOL="${SPACESHIP_PACKAGE_SYMBOL="📦 "}"
|
|
|
22
22
|
SPACESHIP_PACKAGE_COLOR="${SPACESHIP_PACKAGE_COLOR="red"}"
|
|
23
23
|
|
|
24
24
|
if [ -z "$SPACESHIP_PACKAGE_ORDER" ]; then
|
|
25
|
-
SPACESHIP_PACKAGE_ORDER=(npm lerna cargo composer julia)
|
|
25
|
+
SPACESHIP_PACKAGE_ORDER=(npm lerna cargo composer julia maven gradle)
|
|
26
26
|
fi
|
|
27
27
|
|
|
28
28
|
# ------------------------------------------------------------------------------
|
|
@@ -89,6 +89,24 @@ spaceship_package::julia() {
|
|
|
89
89
|
spaceship::datafile --toml $project_toml "version"
|
|
90
90
|
}
|
|
91
91
|
|
|
92
|
+
spaceship_package::maven() {
|
|
93
|
+
|
|
94
|
+
spaceship::upsearch -s pom.xml || return
|
|
95
|
+
|
|
96
|
+
local maven_exe=$(spaceship::upsearch mvnw) || (spaceship::exists mvn && maven_exe="mvn") || return
|
|
97
|
+
|
|
98
|
+
$maven_exe help:evaluate -q -DforceStdout -D"expression=project.version" 2>/dev/null
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
spaceship_package::gradle() {
|
|
102
|
+
|
|
103
|
+
spaceship::upsearch -s settings.gradle settings.gradle.kts || return
|
|
104
|
+
|
|
105
|
+
local gradle_exe=$(spaceship::upsearch gradlew) || (spaceship::exists gradle && gradle_exe="gradle") || return
|
|
106
|
+
|
|
107
|
+
$gradle_exe properties --no-daemon --console=plain -q 2>/dev/null | grep "^version:" | awk '{printf $2}'
|
|
108
|
+
}
|
|
109
|
+
|
|
92
110
|
# ------------------------------------------------------------------------------
|
|
93
111
|
# Section
|
|
94
112
|
# ------------------------------------------------------------------------------
|
package/sections/php.zsh
CHANGED
|
@@ -29,7 +29,7 @@ spaceship_php() {
|
|
|
29
29
|
|
|
30
30
|
spaceship::exists php || return
|
|
31
31
|
|
|
32
|
-
local php_version=$(php -v 2>&1 |
|
|
32
|
+
local php_version=$(php -v 2>&1 | spaceship::grep -oe "^PHP\s*[0-9.]\+" | awk '{print $2}')
|
|
33
33
|
|
|
34
34
|
spaceship::section \
|
|
35
35
|
--color "$SPACESHIP_PHP_COLOR" \
|