зеркало из https://github.com/microsoft/git.git
remote-{ext,fd}: print usage message on invalid arguments
We just say "Expected two arguments" when we get a different number of arguments, but we can be slightly friendlier. People shouldn't generally be running remote helpers themselves, but curious users might say "git remote-ext -h". Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Родитель
619b6c1710
Коммит
bb246590a1
|
@ -3,6 +3,9 @@
|
||||||
#include "run-command.h"
|
#include "run-command.h"
|
||||||
#include "pkt-line.h"
|
#include "pkt-line.h"
|
||||||
|
|
||||||
|
static const char usage_msg[] =
|
||||||
|
"git remote-ext <remote> <url>";
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* URL syntax:
|
* URL syntax:
|
||||||
* 'command [arg1 [arg2 [...]]]' Invoke command with given arguments.
|
* 'command [arg1 [arg2 [...]]]' Invoke command with given arguments.
|
||||||
|
@ -193,7 +196,7 @@ static int command_loop(const char *child)
|
||||||
int cmd_remote_ext(int argc, const char **argv, const char *prefix)
|
int cmd_remote_ext(int argc, const char **argv, const char *prefix)
|
||||||
{
|
{
|
||||||
if (argc != 3)
|
if (argc != 3)
|
||||||
die("Expected two arguments");
|
usage(usage_msg);
|
||||||
|
|
||||||
return command_loop(argv[2]);
|
return command_loop(argv[2]);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,9 @@
|
||||||
#include "builtin.h"
|
#include "builtin.h"
|
||||||
#include "transport.h"
|
#include "transport.h"
|
||||||
|
|
||||||
|
static const char usage_msg[] =
|
||||||
|
"git remote-fd <remote> <url>";
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* URL syntax:
|
* URL syntax:
|
||||||
* 'fd::<inoutfd>[/<anything>]' Read/write socket pair
|
* 'fd::<inoutfd>[/<anything>]' Read/write socket pair
|
||||||
|
@ -57,7 +60,7 @@ int cmd_remote_fd(int argc, const char **argv, const char *prefix)
|
||||||
char *end;
|
char *end;
|
||||||
|
|
||||||
if (argc != 3)
|
if (argc != 3)
|
||||||
die("Expected two arguments");
|
usage(usage_msg);
|
||||||
|
|
||||||
input_fd = (int)strtoul(argv[2], &end, 10);
|
input_fd = (int)strtoul(argv[2], &end, 10);
|
||||||
|
|
||||||
|
|
Загрузка…
Ссылка в новой задаче