From: Junio C Hamano <gitster@pobox.com>
To: Erik Cervin Edin <erik@cervined.in>
Cc: "Johannes Schindelin" <johannes.schindelin@gmx.de>,
"brian m. carlson" <sandals@crustytoothpaste.net>,
"Ævar Arnfjörð Bjarmason" <avarab@gmail.com>,
"Sean Allred" <allred.sean@gmail.com>,
git@vger.kernel.org
Subject: Re: Custom subcommand help handlers
Date: Wed, 22 Dec 2021 16:11:45 -0800 [thread overview]
Message-ID: <xmqq35mkdvsu.fsf@gitster.g> (raw)
In-Reply-To: <CA+JQ7M-8LydHMCgMYGP9LNMJMWk_-7LLYa5WEMMb_QMpeF-+Ag@mail.gmail.com> (Erik Cervin Edin's message of "Thu, 23 Dec 2021 00:40:53 +0100")
Erik Cervin Edin <erik@cervined.in> writes:
> Another observation.
>
> This also applies to external aliases
> git -c alias.fr='!git-filter-repo' fr --help
> returns
> 'fr' is aliased to '!git-filter-repo'
> w exit code 0
I do not know what your 'w' is. To me I get
$ git -c alias.fr='!git-filter-repo' fr --help
'fr' is aliased to '!git-filter-repo'
which is consistent with what I get for other aliases, e.g.
$ git -c alias.lg='log --oneline' lg --help
'lg' is aliased to 'log --oneline'
folowed by whatever "log --help" would give us.
So hopefully when your 'w' learns to show the documentation for
'git-filter-repo' command, such an alias would also work as
expected, no?
Anyway, unlike "man" and "info" where there is a standard way to
tell the command that "I have documentation pages in these places"
so that additional documentation can be installed to locations the
user chooses (and has access to), the "web" format viewers are
invoked without such customizability, i.e. in builtin/help.c, we see
this code snippet:
static void get_html_page_path(struct strbuf *page_path, const char *page)
{
struct stat st;
char *to_free = NULL;
if (!html_path)
html_path = to_free = system_path(GIT_HTML_PATH);
/*
* Check that the page we're looking for exists.
*/
if (!strstr(html_path, "://")) {
if (stat(mkpath("%s/%s.html", html_path, page), &st)
|| !S_ISREG(st.st_mode))
die("'%s/%s.html': documentation file not found.",
html_path, page);
}
strbuf_init(page_path, 0);
strbuf_addf(page_path, "%s/%s.html", html_path, page);
free(to_free);
}
It may not be a bad idea to extand the function to understand a new
GIT_HTML_PATH environment variable, which can be a colon-separated
list of directories just like MANPATH and INFOPATH are. It would be
rather trivial to update the block with a call to stat() above to a
loop over these directories.
next prev parent reply other threads:[~2021-12-23 0:11 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-12-18 16:08 Custom subcommand help handlers Sean Allred
2021-12-20 11:11 ` Ævar Arnfjörð Bjarmason
2021-12-20 12:37 ` Erik Cervin Edin
2021-12-20 22:54 ` brian m. carlson
2021-12-20 23:06 ` Junio C Hamano
2021-12-21 9:12 ` Erik Cervin Edin
2021-12-22 16:19 ` Johannes Schindelin
2021-12-22 19:53 ` Junio C Hamano
2021-12-22 23:40 ` Erik Cervin Edin
2021-12-23 0:11 ` Junio C Hamano [this message]
2021-12-23 11:33 ` Erik Cervin Edin
2021-12-23 15:07 ` Philip Oakley
2021-12-24 0:16 ` Junio C Hamano
2021-12-24 11:26 ` Philip Oakley
2022-02-12 22:29 ` Sean Allred
2021-12-20 22:39 ` Johannes Schindelin
2021-12-21 2:51 ` Ævar Arnfjörð Bjarmason
2021-12-22 16:16 ` Johannes Schindelin
2021-12-22 17:44 ` Ævar Arnfjörð Bjarmason
2022-02-12 22:23 ` Sean Allred
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=xmqq35mkdvsu.fsf@gitster.g \
--to=gitster@pobox.com \
--cc=allred.sean@gmail.com \
--cc=avarab@gmail.com \
--cc=erik@cervined.in \
--cc=git@vger.kernel.org \
--cc=johannes.schindelin@gmx.de \
--cc=sandals@crustytoothpaste.net \
/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.
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).