1
0
Fork 0
mirror of https://github.com/git/git.git synced 2024-05-18 12:26:33 +02:00
Commit Graph

10 Commits

Author SHA1 Message Date
Vikrant Varma e56181060e help: add help_unknown_ref()
When the user gives an unknown string to a command that expects to
get a ref, we could be more helpful than just saying "that's not a
ref" and die.

Add helper function help_unknown_ref() to take care of displaying an
error message along with a list of suggested refs the user might
have meant.  An interaction with "git merge" might go like this:

	$ git merge foo
	merge: foo - not something we can merge

	Did you mean one of these?
	    origin/foo
	    upstream/foo

Signed-off-by: Vikrant Varma <vikrant.varma94@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-05-08 15:31:54 -07:00
Junio C Hamano f4ed0af6e2 Merge branch 'nd/columns'
A couple of commands learn --column option to produce columnar output.

By Nguyễn Thái Ngọc Duy (9) and Zbigniew Jędrzejewski-Szmek (1)
* nd/columns:
  tag: add --column
  column: support piping stdout to external git-column process
  status: add --column
  branch: add --column
  help: reuse print_columns() for help -a
  column: add dense layout support
  t9002: work around shells that are unable to set COLUMNS to 1
  column: add columnar layout
  Stop starting pager recursively
  Add column layout skeleton and git-column
2012-05-03 15:13:31 -07:00
Nguyễn Thái Ngọc Duy dbfae68969 help: reuse print_columns() for help -a
"help -a" also respects column.ui (and column.help if presents)

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-04-27 09:26:38 -07:00
Nguyễn Thái Ngọc Duy 4470ef9497 help: replace underlining "help -a" headers using hyphens with a blank line
We used to underline a header text, like this:

    This is a header
    ----------------
    content...

But calculating text length so that the dashes align with the text
could get complicated because the text could be in any charset in
translated Git.

There is no point to use this pseudo underline; simply a blank
line would do and it even makes it easier to read:

    This is a header

    content...

While at it, give translators more context to translate, e.g.
e.g.  "git commands available..." instead of "%s available..."

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-04-25 10:30:11 -07:00
Thiago Farina fd5c363da4 builtin.h: Move two functions definitions to help.h.
The two functions defined here are implemented in help.c, so makes more sense
to put the definition of those in help.h instead of in builtin.h.

Signed-off-by: Thiago Farina <tfransosi@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-09-01 08:00:51 -07:00
Junio C Hamano 277cd4c4bd Merge branch 'ar/autospell'
* ar/autospell:
  Add help.autocorrect to enable/disable autocorrecting
  git wrapper: DWIM mistyped commands
2008-09-07 23:52:16 -07:00
Johannes Schindelin 8af84dadb1 git wrapper: DWIM mistyped commands
This patch introduces a modified Damerau-Levenshtein algorithm into
Git's code base, and uses it with the following penalties to show some
similar commands when an unknown command was encountered:

	swap = 0, insertion = 1, substitution = 2, deletion = 4

A typical output would now look like this:

	$ git sm
	git: 'sm' is not a git-command. See 'git --help'.

	Did you mean one of these?
		am
		rm

The cut-off is at similarity rating 6, which was empirically determined
to give sensible results.

As a convenience, if there is only one candidate, Git continues under
the assumption that the user mistyped it.  Example:

	$ git reabse
	WARNING: You called a Git program named 'reabse', which does
	not exist.
	Continuing under the assumption that you meant 'rebase'
	[...]

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Alex Riesen <raa.lkml@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-08-31 10:14:58 -07:00
Alex Riesen e321180ed3 Remove calculation of the longest command name from where it is not used
Just calculate it where it is needed - it is cheap and trivial,
as all the lengths are already there (stored when creating the
command lists).

Signed-off-by: Alex Riesen <raa.lkml@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-08-28 21:49:55 -07:00
Miklos Vajna 3d78d1f18f Builtin git-help.
This patch splits out git-help's functions to builtin-help.c and leaves
only functions used by other builtins in help.c.

First this removes git-help's functions from libgit which are not
interesting for other builtins, second this makes 'git help help' work
again.

Signed-off-by: Miklos Vajna <vmiklos@frugalware.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-08-02 18:06:37 -07:00
Miklos Vajna 940208a771 builtin-help: make some internal functions available to other builtins
Make load_command_list() capable of filtering for a given prefix and
loading into a pair of "struct cmdnames" supplied by the caller.

Make the static add_cmdname(), exclude_cmds() and is_in_cmdlist()
functions non-static.

Make list_commands() accept a custom title, and work from a pair of
"struct cmdnames" supplied by the caller.

Signed-off-by: Miklos Vajna <vmiklos@frugalware.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-07-29 23:21:36 -07:00