I'm thinking about changing how the configuration is specified. Rather than having users modify the script or set environment variables, the script would take additional command-line arguments. I would do this for deploy_directory, deploy_branch, and repo. I would eliminate default_username and default_email and just require the user to have git sufficiently configured beforehand.
I'm considering a syntax like this: deploy.sh [<options>] [<directory> [<branch> [<repository>]]]
pros:
- the script doesn't need to be modified, so it can be shared across projects, installed as a package, and write protected
- no polluting of environment variables, no chance of name collisions
- makes apparent that a relative
deploy_directory is relative to the current working directory, eliminating the need to mention this in the readme
cons:
- complicates ad-hoc deployments not using the defaults, as you would now have to either remember to include the arguments every time or create a wrapper script
- having 3 positional arguments, it may be hard to remember which is which
- will probably complicate argument parsing
questions:
- which arguments should be positional or named? (e.g., should we do something like this instead?:
deploy.sh [-d <directory>] ...)
- which arguments should still have defaults or be required?
Let me know if you think this is a good or bad idea.
I'm thinking about changing how the configuration is specified. Rather than having users modify the script or set environment variables, the script would take additional command-line arguments. I would do this for
deploy_directory,deploy_branch, andrepo. I would eliminatedefault_usernameanddefault_emailand just require the user to have git sufficiently configured beforehand.I'm considering a syntax like this:
deploy.sh [<options>] [<directory> [<branch> [<repository>]]]pros:
deploy_directoryis relative to the current working directory, eliminating the need to mention this in the readmecons:
questions:
deploy.sh [-d <directory>] ...)Let me know if you think this is a good or bad idea.