From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-3.1 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_EF,HEADER_FROM_DIFFERENT_DOMAINS,HTML_MESSAGE, MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham autolearn_force=no version=3.4.4 Received: from zero.zsh.org (zero.zsh.org [IPv6:2a02:898:31:0:48:4558:7a:7368]) by inbox.vuxu.org (Postfix) with ESMTP id E3B44234B1 for ; Wed, 8 May 2024 10:56:38 +0200 (CEST) ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20210803; t=1715158598; b=lPvlko9hMd7FulYt4CJMCexoY9mw2LSiMuqbea1lFMNno0bEdOsbAK0ynjEhH9GyCtMgBymZEc FDCLhFN7/e4C+mIhbXB3cCZIVPPDKUWiQOzBlHE772+zjUgqjK/PV7ANp9iNaF1/BtJVpsUQfH K4q9RUVM0w9b3JaXddS++jXRWTSoPdlyCFlmE+bS98kGc/PblPR4yXekB2oA9hMmjerqFNZWeo pBph4yFI/xJLlT75kTI+GUssHGXwvt/RZgJKc/IhWLdBliVjiY/5tMQVoqFuwLa9soMZ2fgyGd 2oOD5rWHt2Ws1Db0bFKQiD/GtWl8UjDElWF2AD/nFuHcwg==; ARC-Authentication-Results: i=1; zsh.org; iprev=pass (turk.sphnet.in) smtp.remote-ip=213.133.98.148; dmarc=none header.from=sphnet.in; arc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed; d=zsh.org; s=rsa-20210803; t=1715158598; bh=juwV+4zvBFbCC9w7ZUR0Unk0ZWP9/Vk6Cmw6H1gK8iM=; h=List-Archive:List-Owner:List-Post:List-Unsubscribe:List-Subscribe:List-Help: List-Id:Sender:Content-Type:Message-ID:Subject:To:From:Date:MIME-Version: DKIM-Signature; b=eH88mMTHRzVVmFREuMh+jUwJXjRjpt5tKXP+9OBiV6NH38M1cuHQ2G2oLs9UW17aoRlr4W6mJO OHzT9xzfh136JR4ejiG4bSMYj6SmtidY72aCrQneOlTrA6pbpYPF/6ctkHYpVl1jZ5tX8ocodn x82Glbli8+6/OXV4ia570VSXynMSorfRPZUMjYkuq6BhNlAHyc5IQD0Pq7HnPFmyV0gYtLK/EP r5ysF15UoRhJO2611aqNSqIdPJPdcPft7Jp+BPZiYgMlFyaMaCxWWdATttCXvUW9OCpxIc5UzJ zkW9XW0PkBVIbVYkNiAwTjqnL3idml9biQ0Bnel7Px07uA==; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=zsh.org; s=rsa-20210803; h=List-Archive:List-Owner:List-Post:List-Unsubscribe: List-Subscribe:List-Help:List-Id:Sender:Content-Type:Message-ID:Subject:To: From:Date:MIME-Version:Reply-To:Cc:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:In-Reply-To:References; bh=9zFzxrThJKWAmrn1ii/qSu/KC4RycUtEHIoyqDcR0qo=; b=FuSLMz9S+sTAJTnSxGCAjeKVy9 mcmOmai4slUBQD8IK1J7GS+Y40biwBZ+nBRjpiypepVn012U8jnYGPewhvYUcfzgeZo1BWfb8n+yz tzz5tpnISMJ0qSXzY+BqNiB6bsxnhw8vNzAwZGzd+7eWjIkzNcrigVLZ2KcgbeHxctcEfn6Rx6GEf 4/EKs/X/Utc7sanO59G7fOE7ltsVoJ57OcKhIfNkOAZNrJ8GfyqToU8gmCsjd/SI3exE0OcXc/Od9 /jq/D5Wk6Ea2ceg0aOFSuz9/NM8O85NDy9tS80YNFg/74f7MDGoDmsKIe0iyDUh1/EqjnMhXHvlTT mz3Ub0bg==; Received: by zero.zsh.org with local id 1s4d6M-0003ue-4Y; Wed, 08 May 2024 08:56:38 +0000 Authentication-Results: zsh.org; iprev=pass (turk.sphnet.in) smtp.remote-ip=213.133.98.148; dmarc=none header.from=sphnet.in; arc=none Received: from turk.sphnet.in ([213.133.98.148]:46494) by zero.zsh.org with esmtps (TLS1.3:TLS_AES_256_GCM_SHA384:256) id 1s4d63-0003bT-Re; Wed, 08 May 2024 08:56:20 +0000 Received: from tools.sphnet.in (strandbeest [10.4.1.13]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: sph@sphnet.in) by turk.sphnet.in (Postfix) with ESMTPSA id 073F119ED5FE for ; Wed, 08 May 2024 10:56:19 +0200 (CEST) MIME-Version: 1.0 Date: Wed, 08 May 2024 10:56:18 +0200 From: sph@sphnet.in To: zsh-workers@zsh.org Subject: [PATCH] feat(zkbd): make zkbd do its magic in the specified directory Message-ID: <2c0392d360227f3f604c42c2ddfee332@sphnet.in> X-Sender: sph@sphnet.in Content-Type: multipart/alternative; boundary="=_9863018435a41c3289461dea82ea62b5" X-Seq: 52917 Archived-At: X-Loop: zsh-workers@zsh.org Errors-To: zsh-workers-owner@zsh.org Precedence: list Precedence: bulk Sender: zsh-workers-request@zsh.org X-no-archive: yes List-Id: List-Help: , List-Subscribe: , List-Unsubscribe: , List-Post: List-Owner: List-Archive: --=_9863018435a41c3289461dea82ea62b5 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII; format=flowed 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 --=_9863018435a41c3289461dea82ea62b5 Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=UTF-8

Hi guys,

I've been trying to segment my stuff as per XDG guidelines and zkbd insi= sted 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 direc= tory of their choosing as the output dir of zkbd.

diff --g= it a/Doc/Zsh/contrib.yo b/Doc/Zsh/contrib.yo
index c1bea6022..3be632c9f 10= 0644
--- 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
&nb= sp;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= =2E This may be overridden with the option tt(-d)
+if you plan to keep i= t elsewhere: tt(zkbd -d /path/to/zkbd).
 
 You may read this fi= le into your tt(.zshrc) or another startup file with
 the `tt(source)= ' or `tt(.)' commands, then reference the tt(key) parameter
diff --git a/F= unctions/Misc/zkbd b/Functions/Misc/zkbd

index 1065a84f1..7b9d5b8c4 100644=
+++ b/Functions/Misc/zkbd
@@ -11,7 +11,9 @@
=  emulate -RL zsh
 local zkbd term key seq
 
-zkbd=3D${ZDO= TDIR:-$HOME}/.zkbd

+zparseopts -D -F -- d:=3Drawdir || return 1
+[[ -n "$= rawdir" ]] && zkbd=3D"${rawdir[2]}"
+[[ ! -d "$zkbd" ]] &&= zkbd=3D"${ZDOTDIR:-$HOME}/.zkbd"
 [[ -d $zkbd ]] || mkdir $zkbd || r= eturn 1
 
 trap 'unfunction getmbkey getseq; command rm -f $zkb= d/$TERM.tmp' 0

--=_9863018435a41c3289461dea82ea62b5--