zsh-workers
 help / color / mirror / code / Atom feed
From: sph@sphnet.in
To: zsh-workers@zsh.org
Subject: [PATCH] feat(zkbd): make zkbd do its magic in the specified directory
Date: Wed, 08 May 2024 10:56:18 +0200	[thread overview]
Message-ID: <2c0392d360227f3f604c42c2ddfee332@sphnet.in> (raw)

[-- 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 --]

             reply	other threads:[~2024-05-08  8:56 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-08  8:56 sph [this message]
2024-05-11 21:19 ` Bart Schaefer
2024-05-11 21:45   ` Lawrence Velázquez

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2c0392d360227f3f604c42c2ddfee332@sphnet.in \
    --to=sph@sphnet.in \
    --cc=zsh-workers@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).