[PATCH 0/2] small mtd-utils fixes

Mike Frysinger vapier.adi at gmail.com
Wed Nov 23 20:45:18 EST 2011


On Wed, Nov 23, 2011 at 02:45, Artem Bityutskiy wrote:
> On Tue, 2011-11-22 at 17:21 -0500, Mike Frysinger wrote:
>> On Tue, Nov 22, 2011 at 16:38, Artem Bityutskiy wrote:
>> > On Sun, 2011-11-20 at 23:22 -0500, Mike Frysinger wrote:
>> >> On Sun, Nov 20, 2011 at 08:08, Artem Bityutskiy wrote:
>> >> > usage() {
>> >> >        cat <<EOF
>> >> > Usage: ${0##*/} <new_ver> <outdir>
>> >> >
>> >> > <new_ver>  - mtd utils version to create in X.Y.Z format
>> >> > <outdir>   - the output directory where to store the tarball with the
>> >> >             gpg signature
>> >> > EOF
>> >> >        exit 0
>> >> > }
>> >>
>> >> i'd have outdir be optional and default to $PWD
>> >
>> > Yeah, but this would require me to add options handling using getopt,
>> > because optional parameters have to have an option. I just do not feel
>> > it is necessary right now. This can be done at any point if someone
>> > needs.
>>
>> i don't think so
>>
>> case $# in
>>   0) usage ;;
>>   1|2) ;;
>>   *) fatal "Insufficient or too many argumetns" ;;
>> esac
>>
>> new_ver="$1"; shift
>> outdir="${1:-.}"; shift
>
> I did not mean it is technincally impossible, I meant that it is just
> normal Unix rule which I want to stick with, at least in simple cases:
>
> 1. Non-mandatory arguments come with options like -x <blah>
> 2. Mandatory arguments come come without options.
>
> utility < -x blah and other optional stuff> <arg1> <other mandatory
> args>

sure, but we're not taking about options here, we're talking about
required arguments:
./make-release.sh <version> [output_dir]

if we were to make it into:
./make-release.sh [-o output_dir] <version>

then i'd understand the `getopt` desire
-mike



More information about the linux-mtd mailing list