diff options
author | Kyle Evans <kevans@FreeBSD.org> | 2020-07-22 17:33:35 +0000 |
---|---|---|
committer | Kyle Evans <kevans@FreeBSD.org> | 2020-07-22 17:33:35 +0000 |
commit | ca7f7593ba7c3e5f930089bc07b20fdd5ab5d6cc (patch) | |
tree | c81ac0cbe69fd90cd81a01a28f406071aaffeebc /usr.sbin/pkg | |
parent | 94140f4781f83c9e98f582439ed69d000ff0323a (diff) |
pkg-bootstrap: complain on improper `pkg bootstrap` usage
Right now, the bootstrap will gloss over things like pkg bootstrap -x or
pkg bootstrap -f pkg. Make it more clear that this is incorrect, and hint
at the correct formatting.
Reported by: jhb (IIRC via IRC)
Approved by: bapt, jhb, manu
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D24750
Notes
Notes:
svn path=/head/; revision=363421
Diffstat (limited to 'usr.sbin/pkg')
-rw-r--r-- | usr.sbin/pkg/pkg.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/usr.sbin/pkg/pkg.c b/usr.sbin/pkg/pkg.c index 7e2359aa97b1..50b196fd9b30 100644 --- a/usr.sbin/pkg/pkg.c +++ b/usr.sbin/pkg/pkg.c @@ -1050,8 +1050,16 @@ main(int argc, char *argv[]) if (argc > 1 && strcmp(argv[1], "bootstrap") == 0) { bootstrap_only = true; - if (argc == 3 && strcmp(argv[2], "-f") == 0) + if (argc > 3) { + fprintf(stderr, "Too many arguments\nUsage: pkg bootstrap [-f]\n"); + exit(EXIT_FAILURE); + } + if (argc == 3 && strcmp(argv[2], "-f") == 0) { force = true; + } else if (argc == 3) { + fprintf(stderr, "Invalid argument specified\nUsage: pkg bootstrap [-f]\n"); + exit(EXIT_FAILURE); + } } if ((bootstrap_only && force) || access(pkgpath, X_OK) == -1) { |