| Some other commenters have mentioned environment variables as input. IMO there are broadly two types of command: plumbing and porcelain. There's a certain amount of convention and culture in distinguishing them and I'm not going to try to argue the culture boundary... For the commands which are plumbing (by whatever culture's rules), the following apply: * They are designed to interact with other plumbing: pipes, machine-comprehension, etc * Exit code 0 for success, anything else for error. Don't try to be clever. * You can determine precisely and unambiguously what the behaviour will be, from the invocation alone. Under no circumstances may anything modify this; no configuration, no environment. For the commands which are porcelain (by the same culture's rules, for consistency), the following apply: * Try to be convenient for the user, but don't sacrifice consistency. * If plumbing returns a failure which isn't specifically handled properly, either something is buggy or the user asked for something Not Right; clean up and abort. * Environment and configuration might modify things, but on the command line there must be the option to state 'use this, irrespective of what anything else says' without knowing any details of what the environment or configuration currently say. To make things more exciting, some binaries might be considered porcelain or plumbing contextually, depending on parameters...
(Yes, everyone sane would rather this weren't the case.) |