From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.text.pandoc/33292 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Albert Krewinkel Newsgroups: gmane.text.pandoc Subject: Re: Better way to get default datadir Date: Fri, 10 Nov 2023 14:49:13 +0100 Message-ID: <87edgxwulq.fsf@zeitkraut.de> References: Reply-To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="18335"; mail-complaints-to="usenet@ciao.gmane.io" To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Original-X-From: pandoc-discuss+bncBCZJF7XJTILRBFX4XCVAMGQET7VLHHY-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Fri Nov 10 15:28:43 2023 Return-path: Envelope-to: gtp-pandoc-discuss@m.gmane-mx.org Original-Received: from mail-wm1-f59.google.com ([209.85.128.59]) by ciao.gmane.io with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1r1SV1-0004gW-6H for gtp-pandoc-discuss@m.gmane-mx.org; Fri, 10 Nov 2023 15:28:43 +0100 Original-Received: by mail-wm1-f59.google.com with SMTP id 5b1f17b1804b1-4083fec2c30sf13899925e9.1 for ; Fri, 10 Nov 2023 06:28:43 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1699626522; cv=pass; d=google.com; s=arc-20160816; b=ByUH1oP/G7NU7WCNi3p5+hkD/oJ0ynfMi/WDgRj4l6MDNTdgbCbUwyj4pfAkNKba07 knOJp40aURf/w9RrPMrQCeBcsMMP1+mAV2u0d0fQtFYEBI80vriEwuAggxjdMejcDQ+D TKwINHfgWyR4xV5ebX1I8y4mSR0YdDUR9qMn/11QAF6f5rATpGVqUT2/i7sf8POLklfJ EzQUfFO8hT6PLdAs3u+a1S6WJA4ZyJFiWzPCchrhdVipTzcqglcyo02RakIj2xv1mUvv VuP59eTGCU2vwifWkAKQIlrLEsdA5+De1CRHqF9hnOWofgMoya66/9jn5sjuJzvS86Bh TPfw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post :list-id:mailing-list:precedence:reply-to:mime-version:message-id :in-reply-to:date:subject:to:from:references:sender:dkim-signature; bh=6eVsNyK8uIuif2JPibrsu5uViRdB7/p+gp/eRiWcP0A=; fh=m01AhCNo7xUywHldCVYouaJypLlN7JgtNYbImzBf4N4=; b=xwxcQZWY4yfN4IICft2Y/mTflgs+UxFpWEHdSoWoSViw7SBJz1ut3ks5L3WorOwTVF 8k1l5j1svBKK9WeCqTqLvhDDEJqjjDMc8Yg6nzXZDBI/iY7cZJdIjIGz/j2v1lxr/jyC 9KftLBoXaOZ+XgZp1KIdkYuHklSCjtBr8DHhb2H6HQ5sx9egi1tctS01k/4KvbAjgGop oR5runtoSJZnbjBSjw0Q3NHh365Y0Z6kpq1Gyp6qAuKPnFqwjQe1ztvip598WNoa1imi hZp4l+OfxlplOyroh85j/FD7Zy2SyzLKfEXwL/ve/FA9GqZIn2EY3SD7/bgeKsoRVvtN IkhA== ARC-Authentication-Results: i=2; gmr-mx.google.com; spf=pass (google.com: domain of albert+pandoc-9EawChwDxG8hFhg+JK9F0w@public.gmane.org designates 2001:67c:2050:0:465::101 as permitted sender) smtp.mailfrom=albert+pandoc-9EawChwDxG8hFhg+JK9F0w@public.gmane.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=20230601; t=1699626522; x=1700231322; darn=m.gmane-mx.org; h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post :list-id:mailing-list:precedence:reply-to :x-original-authentication-results:x-original-sender:mime-version :message-id:in-reply-to:date:subject:to:from:references:sender:from :to:cc:subject:date:message-id:reply-to; bh=6eVsNyK8uIuif2JPibrsu5uViRdB7/p+gp/eRiWcP0A=; b=xuG3gve9h/B/YG9VSMsSc1pfNEG0mSVFjUhnbt6gpWYeOZJMdiUTWB1JYhqi21dwzV uDX4PKFKSJZ9mxJ1YzQnTlX0U6Jus4zbXonE23tAlRDQwFn+T0q6sNu0ow9s+75aaCR7 KFghDC94KTBAAiWAtdkcJhmxSmSXsR6PDzbAbluJ7+52gwKoxSoaf6INy56nEpQAb2x5 2fJzUHqS8IRDZkenNnobqYCQBwSO6UG/lUf0xmkEroFV+sU/AWJobJmy0CC82hyOzc8F 61FUYJbxE/xIKKt7j+eVHdnCp79C+KqUnbeDSZ33z1GklEZOD6+V X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1699626522; x=1700231322; h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post :x-spam-checked-in-group:list-id:mailing-list:precedence:reply-to :x-original-authentication-results:x-original-sender:mime-version :message-id:in-reply-to:date:subject:to:from:references:x-beenthere :x-gm-message-state:sender:from:to:cc:subject:date:message-id :reply-to; bh=6eVsNyK8uIuif2JPibrsu5uViRdB7/p+gp/eRiWcP0A=; b=Mw2XvHKrkejx+EmaEuct+IELhyo8WuTiRiYi10r+Wj04FsVjMAUiEdXv7kCXoJ4/S+ rnlBKjid/HFLaa/bqqoRbZBSBYCqOyvJgrh/haSMBiY9tdLU8LFVMekyyi/tRdFg+ZqW QRYjCm/EjVzQ05EBEYX/W96G2O5nLZpWlwn7T33I0VxE3K1k7tPP8E3FLZJrqP3QBcC2 /Ql0e/XD83nfa6F2h4ayahz0inV6+yF3h+8QjtyHpB9rEeXx27DGot4d3xx2ZOQDJE9t nkUf2t Original-Sender: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org X-Gm-Message-State: AOJu0YzKM8gJcjlqNqzyU9rp6qAYVMUA9k6u502a1l2sENC7p5qKT/u2 IzHLtKZddeyVrho6eH24hDQ= X-Google-Smtp-Source: AGHT+IHNLGN2XiIt1xGrhsMe7722tPBewe54kyQILFgGrbxoOYNITpbx+Ed0oL5uZnqhGYHeUdtPGA== X-Received: by 2002:a05:6000:1544:b0:32d:ad05:906c with SMTP id 4-20020a056000154400b0032dad05906cmr8345942wry.3.1699626522496; Fri, 10 Nov 2023 06:28:42 -0800 (PST) X-BeenThere: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Original-Received: by 2002:adf:ffc5:0:b0:32d:72f4:a95f with SMTP id x5-20020adfffc5000000b0032d72f4a95fls774217wrs.2.-pod-prod-01-eu; Fri, 10 Nov 2023 06:28:37 -0800 (PST) X-Received: by 2002:a5d:6c6d:0:b0:32f:8a45:937b with SMTP id r13-20020a5d6c6d000000b0032f8a45937bmr7860094wrz.8.1699626516732; Fri, 10 Nov 2023 06:28:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1699626516; cv=none; d=google.com; s=arc-20160816; b=xDftKvpliRh6PF/0ZT+e3FmFTbQIdSdqIp8m48Z1F1U4YZElpXobocG5ky3C4MtLxb i5Yniki313YOh7IaMSBLqmrdS5hndYsAy/7RRh7jKY4ei3IM9w9dAFdEzLLZMe4oABIR fxQ82QS5CxXcBih2C80O4ht6sURbwhj4WCqbbcsX4LmpBlUL+Lqeiz0RBzAw3LQ2e82j dbgha8pcb3O60oLd3ZZCdpWyBX2fEhyeVBNFDmK8bmZf8QUWgenimTmuZKnujkN06RH/ 0YFUa2voH4pRDGANIDLOESRQ9yUTKbGsDe/3rbkPlBG0RugP4QgIQmf3fex0aLLwnTVL u7jg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:message-id:in-reply-to:date:subject:to:from:references; bh=gVPB7bDTZcNci7Fh2yyBjBTaeOIkmjwrQ6KADZd99M0=; fh=m01AhCNo7xUywHldCVYouaJypLlN7JgtNYbImzBf4N4=; b=j5svIFXdJaD+usvmwJsJDcrcYQYJ+RY0xkbqDjW/8jMYDaTdw67xl878Xb+sL+h3yl mHz/6v5UgpktECdhRxTIbYdExQu5nNNtIMUDSX9OK4+gq+XtNzJNufiAtUomI+mq7KYw 022NRxlH9XzGDh90Cd9zMwTj8TDshBOWMO7zkA+XQScFVCLhbxQii+y3SdqIcR+p0Y/T v7B6W6XQFOGrhxPq9h68wax/L+L0vevMDsBhpi0m3QZZSP5IbGk7ITiKKkpN2j3e04bt VTaMT/TR0DKPkwkCCucX877BhrD1594ARP58B+YZvOZPUDd4kWh8ZTZGwQnpLyNRga9g 7jnw== ARC-Authentication-Results: i=1; gmr-mx.google.com; spf=pass (google.com: domain of albert+pandoc-9EawChwDxG8hFhg+JK9F0w@public.gmane.org designates 2001:67c:2050:0:465::101 as permitted sender) smtp.mailfrom=albert+pandoc-9EawChwDxG8hFhg+JK9F0w@public.gmane.org Original-Received: from mout-p-101.mailbox.org (mout-p-101.mailbox.org. [2001:67c:2050:0:465::101]) by gmr-mx.google.com with ESMTPS id h6-20020a05600016c600b003233224954esi799550wrf.6.2023.11.10.06.28.36 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Nov 2023 06:28:36 -0800 (PST) Received-SPF: pass (google.com: domain of albert+pandoc-9EawChwDxG8hFhg+JK9F0w@public.gmane.org designates 2001:67c:2050:0:465::101 as permitted sender) client-ip=2001:67c:2050:0:465::101; Original-Received: from smtp102.mailbox.org (smtp102.mailbox.org [10.196.197.102]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mout-p-101.mailbox.org (Postfix) with ESMTPS id 4SRh5G4J8Xz9sbr for ; Fri, 10 Nov 2023 15:28:34 +0100 (CET) In-reply-to: X-Original-Sender: albert+pandoc-9EawChwDxG8hFhg+JK9F0w@public.gmane.org X-Original-Authentication-Results: gmr-mx.google.com; spf=pass (google.com: domain of albert+pandoc-9EawChwDxG8hFhg+JK9F0w@public.gmane.org designates 2001:67c:2050:0:465::101 as permitted sender) smtp.mailfrom=albert+pandoc-9EawChwDxG8hFhg+JK9F0w@public.gmane.org Precedence: list Mailing-list: list pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org; contact pandoc-discuss+owners-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org List-ID: X-Google-Group-Id: 1007024079513 List-Post: , List-Help: , List-Archive: , List-Unsubscribe: , Xref: news.gmane.io gmane.text.pandoc:33292 Archived-At: DG writes: > I have a script installs templates and default files on multiple platforms. > > In order to get the default datadir I use sed : > > pandoc -v | sed -rn "s/User data directory: (.*)$/\1/p" > > It works, but it is (a) not very elegant and (b) it depends on sed and > might fail on windows. My question is: What am I missing? Is there a > more direct way to get the default datadir? First, here's a way that DOESN'T work, but maybe it should? pandoc lua -e 'print(PANDOC_STATE.user_data_dir)' This only prints `nil`, because the value is not set when pandoc is called as a Lua interpreter. But it could be argued that the default data dir should be returned if it exists. The alternative is to use a single-line file print(PANDOC_STATE.user_data_dir) and to pass it to pandoc as a Lua filter, e.g. echo "" | pandoc -L datadir.lua Some shells support "process substitution". In those cases we can write a one liner echo "" | pandoc -L <(echo 'print(PANDOC_STATE.user_data_dir)') or even just pandoc -L <(echo 'print(PANDOC_STATE.user_data_dir)') <<< '' But that's not portable. Feel free to raise an issue on the bug tracker to get future support for the potentially simpler version mentioned above. -- Albert Krewinkel GPG: 8eed e3e2 e8c5 6f18 81fe e836 388d c0b2 1f63 1124