* [RFC PATCH 1/2] complete absolute paths for mpc add
@ 2024-09-27 16:31 Karel Balej
2024-09-27 16:31 ` [RFC PATCH 2/2] enable completion for mpc insert Karel Balej
0 siblings, 1 reply; 2+ messages in thread
From: Karel Balej @ 2024-09-27 16:31 UTC (permalink / raw)
To: zsh-workers; +Cc: balejk
When connecting via Unix socket, mpc can queue files from outside the
music directory as well when given the absolute path.
---
mpc also supports explicitly prefixing the path with file:// which is
not covered here, however according to my testing this only works for
absolute paths too so there doesn't seem to be any benefit.
This implementation doesn't work with environment variables, such as
mpc add $HOME/somethi<tab>, I will appreciate tips on whether there is a
simple way to make this more robust to include situations such as this
instead of just checking for these two specific starting characters.
Thank you and kind regards,
K. B.
Completion/Unix/Command/_mpc | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/Completion/Unix/Command/_mpc b/Completion/Unix/Command/_mpc
index c3f93878ca28..93100de09ca8 100644
--- a/Completion/Unix/Command/_mpc
+++ b/Completion/Unix/Command/_mpc
@@ -178,6 +178,14 @@ _mpc_helper_files() {
fi
}
+(( $+functions[_mpc_helper_all_files] )) ||
+_mpc_helper_all_files() {
+ if [[ $words[CURRENT] == [/~]* ]]; then
+ _files
+ fi
+ _mpc_helper_files
+}
+
(( $+functions[_mpc_helper_directories] )) ||
_mpc_helper_directories() {
if [[ -n $MPD_MUSIC_DIR ]]; then
@@ -204,7 +212,7 @@ _mpc_helper_outputs() {
}
_mpc_add() {
- _mpc_helper_files
+ _mpc_helper_all_files
}
_mpc_albumart() {
--
2.46.0
^ permalink raw reply [flat|nested] 2+ messages in thread
* [RFC PATCH 2/2] enable completion for mpc insert
2024-09-27 16:31 [RFC PATCH 1/2] complete absolute paths for mpc add Karel Balej
@ 2024-09-27 16:31 ` Karel Balej
0 siblings, 0 replies; 2+ messages in thread
From: Karel Balej @ 2024-09-27 16:31 UTC (permalink / raw)
To: zsh-workers; +Cc: balejk
---
Completion/Unix/Command/_mpc | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/Completion/Unix/Command/_mpc b/Completion/Unix/Command/_mpc
index 93100de09ca8..4566866ebfbd 100644
--- a/Completion/Unix/Command/_mpc
+++ b/Completion/Unix/Command/_mpc
@@ -215,6 +215,10 @@ _mpc_add() {
_mpc_helper_all_files
}
+_mpc_insert() {
+ _mpc_helper_all_files
+}
+
_mpc_albumart() {
_mpc_helper_files
}
--
2.46.0
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2024-09-27 16:34 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-09-27 16:31 [RFC PATCH 1/2] complete absolute paths for mpc add Karel Balej
2024-09-27 16:31 ` [RFC PATCH 2/2] enable completion for mpc insert Karel Balej
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).