zsh-workers
 help / color / mirror / code / Atom feed
* [PATCH] feat(zkbd): make zkbd do its magic in the specified directory
@ 2024-05-08  8:56 sph
  2024-05-11 21:19 ` Bart Schaefer
  0 siblings, 1 reply; 3+ messages in thread
From: sph @ 2024-05-08  8:56 UTC (permalink / raw)
  To: zsh-workers

[-- Attachment #1: Type: text/plain, Size: 1538 bytes --]

Hi guys,

I've been trying to segment my stuff as per XDG guidelines and zkbd 
insisted on packing their output in $ZDOTDIR/.zkbd which I did'nt like.

I'd like to add a -d switch to zkbd to allow the user to specify a 
directory of their choosing as the output dir of zkbd.

diff --git a/Doc/Zsh/contrib.yo b/Doc/Zsh/contrib.yo
index c1bea6022..3be632c9f 100644
--- a/Doc/Zsh/contrib.yo
+++ b/Doc/Zsh/contrib.yo
@@ -192,7 +192,8 @@ The keystrokes read by tt(zkbd) are recorded as a 
definition for an
  associative array named tt(key), written to a file in the subdirectory
  tt(.zkbd) within either your tt(HOME) or tt(ZDOTDIR) directory.  The 
name
  of the file is composed from the tt(TERM), tt(VENDOR) and tt(OSTYPE)
-parameters, joined by hyphens.
+parameters, joined by hyphens. This may be overridden with the option 
tt(-d)
+if you plan to keep it elsewhere: tt(zkbd -d /path/to/zkbd).

  You may read this file into your tt(.zshrc) or another startup file 
with
  the `tt(source)' or `tt(.)' commands, then reference the tt(key) 
parameter
diff --git a/Functions/Misc/zkbd b/Functions/Misc/zkbd
index 1065a84f1..7b9d5b8c4 100644
--- a/Functions/Misc/zkbd
+++ b/Functions/Misc/zkbd
@@ -11,7 +11,9 @@
  emulate -RL zsh
  local zkbd term key seq

-zkbd=${ZDOTDIR:-$HOME}/.zkbd
+zparseopts -D -F -- d:=rawdir || return 1
+[[ -n "$rawdir" ]] && zkbd="${rawdir[2]}"
+[[ ! -d "$zkbd" ]] && zkbd="${ZDOTDIR:-$HOME}/.zkbd"
  [[ -d $zkbd ]] || mkdir $zkbd || return 1

  trap 'unfunction getmbkey getseq; command rm -f $zkbd/$TERM.tmp' 0

[-- Attachment #2: Type: text/html, Size: 3955 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] feat(zkbd): make zkbd do its magic in the specified directory
  2024-05-08  8:56 [PATCH] feat(zkbd): make zkbd do its magic in the specified directory sph
@ 2024-05-11 21:19 ` Bart Schaefer
  2024-05-11 21:45   ` Lawrence Velázquez
  0 siblings, 1 reply; 3+ messages in thread
From: Bart Schaefer @ 2024-05-11 21:19 UTC (permalink / raw)
  To: sph; +Cc: zsh-workers

On Wed, May 8, 2024 at 1:56 AM <sph@sphnet.in> wrote:
>
> I've been trying to segment my stuff as per XDG guidelines and zkbd insisted on packing their output in $ZDOTDIR/.zkbd which I did'nt like.
>
> I'd like to add a -d switch to zkbd to allow the user to specify a directory of their choosing as the output dir of zkbd.

I'm debating whether a better approach would be a parameter, for
congruence with e.g. ZDOTDIR itself, HISTFILE, etc.


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] feat(zkbd): make zkbd do its magic in the specified directory
  2024-05-11 21:19 ` Bart Schaefer
@ 2024-05-11 21:45   ` Lawrence Velázquez
  0 siblings, 0 replies; 3+ messages in thread
From: Lawrence Velázquez @ 2024-05-11 21:45 UTC (permalink / raw)
  To: Bart Schaefer, sph; +Cc: zsh-workers

On Sat, May 11, 2024, at 5:19 PM, Bart Schaefer wrote:
> On Wed, May 8, 2024 at 1:56 AM <sph@sphnet.in> wrote:
>>
>> I've been trying to segment my stuff as per XDG guidelines and zkbd insisted on packing their output in $ZDOTDIR/.zkbd which I did'nt like.
>>
>> I'd like to add a -d switch to zkbd to allow the user to specify a directory of their choosing as the output dir of zkbd.
>
> I'm debating whether a better approach would be a parameter, for
> congruence with e.g. ZDOTDIR itself, HISTFILE, etc.

OTOH compinit provides a bit of precedence for using -d like this.

-- 
vq


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-05-11 21:47 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-05-08  8:56 [PATCH] feat(zkbd): make zkbd do its magic in the specified directory sph
2024-05-11 21:19 ` Bart Schaefer
2024-05-11 21:45   ` Lawrence Velázquez

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).