From: Stefan Sperling Subject: Re: tog(1) log by default++ To: Martin Pieuchot , gameoftrees@openbsd.org Date: Thu, 20 Feb 2020 17:53:46 +0100 On Thu, Feb 20, 2020 at 05:24:12PM +0100, Stefan Sperling wrote: > Here is a diff that shows how I would implement this if we really want it. Note that my patch has one particular problem which cannot be easily fixed: > + if (error && error->code != GOT_ERR_CANCELLED) { > + if (is_implicit_log_cmd && > + error->code == GOT_ERR_NO_TREE_ENTRY) { Here, we don't actually know whether GOT_ERR_NO_TREE_ENTRY was raised because the user passed a bad path, or because the library raised this error internally somewhere. I do understand why you want this. But from a maintainer's perspective I am not a fan of this hack. This special case introduces side effects that are not very straightforward to contain. I'd rather avoid the ambiguity and force people to type the command they want to run because this makes it easier to provide reasonable behaviour when errors occur. > + fprintf(stderr, "%s: '%s' is no known command or path\n", > + getprogname(), argv[0]); > + usage(1); > + } else > + fprintf(stderr, "%s: %s\n", getprogname(), error->msg); > + } > return 0; > } > > >