[{"id":582,"web_url":"https://patchwork.libcamera.org/comment/582/","msgid":"<20190125110134.GC2934@pendragon.ideasonboard.com>","date":"2019-01-25T11:01:34","subject":"Re: [libcamera-devel] [PATCH] cam: options: optional arguments\n\tneeds to be specified as --foo=bar","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"Hi Niklas,\n\nOn Fri, Jan 25, 2019 at 12:23:11AM +0100, Niklas Söderlund wrote:\n> It's not state in the documentation but optional arguments needs to be\n> specified using as '--foo=bar' instead of '--foo bar', otherwise the\n> value is not propagated to optarg during argument parsing. Update the\n> usage printing helper to reflect this requirement.\n> \n> Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>\n> ---\n>  src/cam/options.cpp | 3 ++-\n>  1 file changed, 2 insertions(+), 1 deletion(-)\n> \n> diff --git a/src/cam/options.cpp b/src/cam/options.cpp\n> index 82acff9bbeea476d..73d81d0bc0ec6d38 100644\n> --- a/src/cam/options.cpp\n> +++ b/src/cam/options.cpp\n> @@ -143,7 +143,8 @@ void OptionsParser::usage()\n>  \t\t};\n>  \n>  \t\tif (option.argument != ArgumentNone) {\n> -\t\t\targument += std::string(\" \");\n> +\t\t\targument += option.argument == ArgumentOptional ?\n> +\t\t\t\t\"=\" : \" \";\n>  \t\t\tif (option.argument == ArgumentOptional)\n>  \t\t\t\targument += \"[\";\n>  \t\t\targument += option.argumentName;\n\nThis will output\n\n\t-f, --foo value\n\nfor mandatory arguments, and\n\n\t-f, --foo=[value]\n\nfor optional arguments. If we want to print the =, shouldn't it be\n--foo[=value] ? And how should we handle the case where no long option\nis available, with this patch -f=[value] would be printed, which isn't\ncorrect I think.","headers":{"Return-Path":"<laurent.pinchart@ideasonboard.com>","Received":["from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 0325660B1D\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 25 Jan 2019 12:01:35 +0100 (CET)","from pendragon.ideasonboard.com (unknown\n\t[IPv6:2a02:a03f:4499:2700:1060:1d4c:d6a:8e80])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 8FB80325;\n\tFri, 25 Jan 2019 12:01:34 +0100 (CET)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1548414094;\n\tbh=v/tg2hLtR+32FShQCuSt5N8SRQMrgCXLspcAJ2e2cjo=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=ZTB+EodMnqZ9V2xlY6VbGbFNqShsV+SP1YZEoXZ1zrn9TGlVCAz6If017yWN1w4K0\n\t6X7wYFVOm8sLgaNDmgQ5I6N66jtRClYkoGkF0wsZJuqtmnvvHTlgR2UZnvwVnTxs1r\n\tsqsNhnIn8Fl+Q0W2wwIRjvZm6Lh93VtTdwOZA+CA=","Date":"Fri, 25 Jan 2019 13:01:34 +0200","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"Niklas =?utf-8?q?S=C3=B6derlund?= <niklas.soderlund@ragnatech.se>","Cc":"libcamera-devel@lists.libcamera.org","Message-ID":"<20190125110134.GC2934@pendragon.ideasonboard.com>","References":"<20190124232311.29636-1-niklas.soderlund@ragnatech.se>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","Content-Transfer-Encoding":"8bit","In-Reply-To":"<20190124232311.29636-1-niklas.soderlund@ragnatech.se>","User-Agent":"Mutt/1.10.1 (2018-07-13)","Subject":"Re: [libcamera-devel] [PATCH] cam: options: optional arguments\n\tneeds to be specified as --foo=bar","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.23","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","X-List-Received-Date":"Fri, 25 Jan 2019 11:01:35 -0000"}},{"id":586,"web_url":"https://patchwork.libcamera.org/comment/586/","msgid":"<20190125112325.GI4127@bigcity.dyn.berto.se>","date":"2019-01-25T11:23:25","subject":"Re: [libcamera-devel] [PATCH] cam: options: optional arguments\n\tneeds to be specified as --foo=bar","submitter":{"id":5,"url":"https://patchwork.libcamera.org/api/people/5/","name":"Niklas Söderlund","email":"niklas.soderlund@ragnatech.se"},"content":"Hi Laurent,\n\nOn 2019-01-25 13:01:34 +0200, Laurent Pinchart wrote:\n> Hi Niklas,\n> \n> On Fri, Jan 25, 2019 at 12:23:11AM +0100, Niklas Söderlund wrote:\n> > It's not state in the documentation but optional arguments needs to be\n> > specified using as '--foo=bar' instead of '--foo bar', otherwise the\n> > value is not propagated to optarg during argument parsing. Update the\n> > usage printing helper to reflect this requirement.\n> > \n> > Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>\n> > ---\n> >  src/cam/options.cpp | 3 ++-\n> >  1 file changed, 2 insertions(+), 1 deletion(-)\n> > \n> > diff --git a/src/cam/options.cpp b/src/cam/options.cpp\n> > index 82acff9bbeea476d..73d81d0bc0ec6d38 100644\n> > --- a/src/cam/options.cpp\n> > +++ b/src/cam/options.cpp\n> > @@ -143,7 +143,8 @@ void OptionsParser::usage()\n> >  \t\t};\n> >  \n> >  \t\tif (option.argument != ArgumentNone) {\n> > -\t\t\targument += std::string(\" \");\n> > +\t\t\targument += option.argument == ArgumentOptional ?\n> > +\t\t\t\t\"=\" : \" \";\n> >  \t\t\tif (option.argument == ArgumentOptional)\n> >  \t\t\t\targument += \"[\";\n> >  \t\t\targument += option.argumentName;\n> \n> This will output\n> \n> \t-f, --foo value\n> \n> for mandatory arguments, and\n> \n> \t-f, --foo=[value]\n> \n> for optional arguments. If we want to print the =, shouldn't it be\n> --foo[=value] ?\n\nIt should of course be --foo[=value], will fix.\n\n> And how should we handle the case where no long option\n> is available, with this patch -f=[value] would be printed, which isn't\n> correct I think.\n\nGood point, for optional short arguments the syntax would be -fvalue.  \nWould it make sens to print both short and long syntax in the usage?\n\n    -f[value], --foo[=value]\n\nLet me know what you think and I send a v2.","headers":{"Return-Path":"<niklas.soderlund@ragnatech.se>","Received":["from mail-lj1-x241.google.com (mail-lj1-x241.google.com\n\t[IPv6:2a00:1450:4864:20::241])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 6661460B1D\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 25 Jan 2019 12:23:27 +0100 (CET)","by mail-lj1-x241.google.com with SMTP id n18-v6so8060806lji.7\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 25 Jan 2019 03:23:27 -0800 (PST)","from localhost (89-233-230-99.cust.bredband2.com. [89.233.230.99])\n\tby smtp.gmail.com with ESMTPSA id\n\tw9sm1406122lfc.66.2019.01.25.03.23.25\n\t(version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256);\n\tFri, 25 Jan 2019 03:23:25 -0800 (PST)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=ragnatech-se.20150623.gappssmtp.com; s=20150623;\n\th=date:from:to:cc:subject:message-id:references:mime-version\n\t:content-disposition:content-transfer-encoding:in-reply-to\n\t:user-agent; bh=xQYOjwnDiHBDQGvVy8Nrae4DJwQ1HhUm7vGLcyM3RtM=;\n\tb=XWyAflLwjGky/r3wZdP/C4Oc+Xgm9GTZCvVP2mAruSMtFWRX6QnB3Tq3JUAHvMYGl6\n\t7cWDBmGyhY0ehHAVYQkhKlrU4mJAst+KVKz7EhAgdv6bXFbTeEM08g4a4a4qk3sDCJ+D\n\tRblcn5f4NuRZEj8dHBIPd2XMnNfaJpajK/LfQGZ9e4Hj9vaT4xR1AGkgX5dCEhbuzPrZ\n\tiY1Q9zLut8WjA0GA9qMeReysVfs49s7iEJ5hrQQlJOoymUNtdUgfBM5sQf9Od7oPtQ9G\n\tpdJWDQKY32ZXC5U2o0QZKyEUksCNumPOe9hx0rQsnmkucbnbFKzjNWhKYk0ITDO/+gNF\n\t1W8A==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:date:from:to:cc:subject:message-id:references\n\t:mime-version:content-disposition:content-transfer-encoding\n\t:in-reply-to:user-agent;\n\tbh=xQYOjwnDiHBDQGvVy8Nrae4DJwQ1HhUm7vGLcyM3RtM=;\n\tb=t6KE7Gd3IINyUysc6KTu6irgtF8YTes5BDKtwOH6rxRRO23B/hsq5S5gZOPGfp45Ec\n\tqFL8FdtK8brXcqdtqFv1CosZIM38rltGnKAlb2WrSNwR9BVPHdNKFSyAQFBkkLSvJ2Dg\n\tUD0XvFFdM7E+o9NpuWSq1QF6bsdIhkzZrkpbZPKVknu9jhI71pkAi1R6BD4RKUcrUQOz\n\tlyB7trSKFmuTaz8soZzLNyzRWEmOrKCO5oG8S3zm4VOl1qHo/7lCwwQCPBDspDGVTozf\n\tsZxvH60D5hvV1zYXEMW75Gfwe/7MDrOh0ZFt3u+sMu5HMgWNt8Y5JJO93/CwasaGFSMq\n\tAbfg==","X-Gm-Message-State":"AHQUAubdFr0T1mwZ6shJKJdC2RJP9Itk5y8wr+XFF5FCyvl8OZ/Ly06b\n\tS+mNMFRgo4TY1njo0Rkt2SV9Dw==","X-Google-Smtp-Source":"AHgI3IZ+VMHehsgLnLeVJT+SbW/8Xv8nfHhzZ776FL/CMNvXc5bzou/AFTfNcpx1FO9OLlgITN2Xog==","X-Received":"by 2002:a2e:3a10:: with SMTP id\n\th16-v6mr4046795lja.184.1548415406455; \n\tFri, 25 Jan 2019 03:23:26 -0800 (PST)","Date":"Fri, 25 Jan 2019 12:23:25 +0100","From":"Niklas =?iso-8859-1?q?S=F6derlund?= <niklas.soderlund@ragnatech.se>","To":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","Cc":"libcamera-devel@lists.libcamera.org","Message-ID":"<20190125112325.GI4127@bigcity.dyn.berto.se>","References":"<20190124232311.29636-1-niklas.soderlund@ragnatech.se>\n\t<20190125110134.GC2934@pendragon.ideasonboard.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=iso-8859-1","Content-Disposition":"inline","Content-Transfer-Encoding":"8bit","In-Reply-To":"<20190125110134.GC2934@pendragon.ideasonboard.com>","User-Agent":"Mutt/1.10.1 (2018-07-13)","Subject":"Re: [libcamera-devel] [PATCH] cam: options: optional arguments\n\tneeds to be specified as --foo=bar","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.23","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","X-List-Received-Date":"Fri, 25 Jan 2019 11:23:27 -0000"}},{"id":587,"web_url":"https://patchwork.libcamera.org/comment/587/","msgid":"<2146b244-fc4c-7c73-9209-b9209355948a@ideasonboard.com>","date":"2019-01-25T11:39:04","subject":"Re: [libcamera-devel] [PATCH] cam: options: optional arguments\n\tneeds to be specified as --foo=bar","submitter":{"id":4,"url":"https://patchwork.libcamera.org/api/people/4/","name":"Kieran Bingham","email":"kieran.bingham@ideasonboard.com"},"content":"Heya,\n\nOn 25/01/2019 11:23, Niklas Söderlund wrote:\n> Hi Laurent,\n> \n> On 2019-01-25 13:01:34 +0200, Laurent Pinchart wrote:\n>> Hi Niklas,\n>>\n>> On Fri, Jan 25, 2019 at 12:23:11AM +0100, Niklas Söderlund wrote:\n>>> It's not state in the documentation but optional arguments needs to be\n>>> specified using as '--foo=bar' instead of '--foo bar', otherwise the\n>>> value is not propagated to optarg during argument parsing. Update the\n>>> usage printing helper to reflect this requirement.\n>>>\n>>> Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>\n>>> ---\n>>>  src/cam/options.cpp | 3 ++-\n>>>  1 file changed, 2 insertions(+), 1 deletion(-)\n>>>\n>>> diff --git a/src/cam/options.cpp b/src/cam/options.cpp\n>>> index 82acff9bbeea476d..73d81d0bc0ec6d38 100644\n>>> --- a/src/cam/options.cpp\n>>> +++ b/src/cam/options.cpp\n>>> @@ -143,7 +143,8 @@ void OptionsParser::usage()\n>>>  \t\t};\n>>>  \n>>>  \t\tif (option.argument != ArgumentNone) {\n>>> -\t\t\targument += std::string(\" \");\n>>> +\t\t\targument += option.argument == ArgumentOptional ?\n>>> +\t\t\t\t\"=\" : \" \";\n>>>  \t\t\tif (option.argument == ArgumentOptional)\n>>>  \t\t\t\targument += \"[\";\n>>>  \t\t\targument += option.argumentName;\n>>\n>> This will output\n>>\n>> \t-f, --foo value\n>>\n>> for mandatory arguments, and\n>>\n>> \t-f, --foo=[value]\n>>\n>> for optional arguments. If we want to print the =, shouldn't it be\n>> --foo[=value] ?\n> \n> It should of course be --foo[=value], will fix.\n> \n>> And how should we handle the case where no long option\n>> is available, with this patch -f=[value] would be printed, which isn't\n>> correct I think.\n> \n> Good point, for optional short arguments the syntax would be -fvalue.  \n> Would it make sens to print both short and long syntax in the usage?\n> \n>     -f[value], --foo[=value]\n> \n> Let me know what you think and I send a v2.\n\nIs it difficult to accept a space or an = separator on the arguments?","headers":{"Return-Path":"<kieran.bingham@ideasonboard.com>","Received":["from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id C9FAA60B1D\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 25 Jan 2019 12:39:07 +0100 (CET)","from [192.168.0.21]\n\t(cpc89242-aztw30-2-0-cust488.18-1.cable.virginm.net [86.31.129.233])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 2810B325;\n\tFri, 25 Jan 2019 12:39:07 +0100 (CET)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1548416347;\n\tbh=2pZXbzoh2vHBjQynVAoaSH8jSWJe+Pv/d0/hJeNQEWE=;\n\th=Reply-To:Subject:To:Cc:References:From:Date:In-Reply-To:From;\n\tb=K7pSZArzAnOZU9KjMat1tuUVYhvqNECK4gfB9K7J8HO2NSctfO6DZ55hXfjQzgpml\n\tG7NxDG0zQZmKavhcAcV8hKzUNz2urf47usTKOXuEMD+QAyD2F0MDBviflp+NZxUK63\n\t+TK+GKpcXeE6WECqOnTbpwmjh7jG9pp+CMkRvZA8=","Reply-To":"kieran.bingham@ideasonboard.com","To":"=?utf-8?q?Niklas_S=C3=B6derlund?= <niklas.soderlund@ragnatech.se>,\n\tLaurent Pinchart <laurent.pinchart@ideasonboard.com>","Cc":"libcamera-devel@lists.libcamera.org","References":"<20190124232311.29636-1-niklas.soderlund@ragnatech.se>\n\t<20190125110134.GC2934@pendragon.ideasonboard.com>\n\t<20190125112325.GI4127@bigcity.dyn.berto.se>","From":"Kieran Bingham <kieran.bingham@ideasonboard.com>","Openpgp":"preference=signencrypt","Autocrypt":"addr=kieran.bingham@ideasonboard.com; keydata=\n\t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\n\tsbsRB8KNNvVXBOVNwko86rQqF9drZuw=","Organization":"Ideas on Board","Message-ID":"<2146b244-fc4c-7c73-9209-b9209355948a@ideasonboard.com>","Date":"Fri, 25 Jan 2019 11:39:04 +0000","User-Agent":"Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101\n\tThunderbird/60.2.1","MIME-Version":"1.0","In-Reply-To":"<20190125112325.GI4127@bigcity.dyn.berto.se>","Content-Type":"text/plain; charset=utf-8","Content-Language":"en-GB","Content-Transfer-Encoding":"8bit","Subject":"Re: [libcamera-devel] [PATCH] cam: options: optional arguments\n\tneeds to be specified as --foo=bar","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.23","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","X-List-Received-Date":"Fri, 25 Jan 2019 11:39:08 -0000"}},{"id":589,"web_url":"https://patchwork.libcamera.org/comment/589/","msgid":"<20190125133444.GJ4127@bigcity.dyn.berto.se>","date":"2019-01-25T13:34:45","subject":"Re: [libcamera-devel] [PATCH] cam: options: optional arguments\n\tneeds to be specified as --foo=bar","submitter":{"id":5,"url":"https://patchwork.libcamera.org/api/people/5/","name":"Niklas Söderlund","email":"niklas.soderlund@ragnatech.se"},"content":"Hi Kieran,\n\nOn 2019-01-25 11:39:04 +0000, Kieran Bingham wrote:\n> Heya,\n> \n> On 25/01/2019 11:23, Niklas Söderlund wrote:\n> > Hi Laurent,\n> > \n> > On 2019-01-25 13:01:34 +0200, Laurent Pinchart wrote:\n> >> Hi Niklas,\n> >>\n> >> On Fri, Jan 25, 2019 at 12:23:11AM +0100, Niklas Söderlund wrote:\n> >>> It's not state in the documentation but optional arguments needs to be\n> >>> specified using as '--foo=bar' instead of '--foo bar', otherwise the\n> >>> value is not propagated to optarg during argument parsing. Update the\n> >>> usage printing helper to reflect this requirement.\n> >>>\n> >>> Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>\n> >>> ---\n> >>>  src/cam/options.cpp | 3 ++-\n> >>>  1 file changed, 2 insertions(+), 1 deletion(-)\n> >>>\n> >>> diff --git a/src/cam/options.cpp b/src/cam/options.cpp\n> >>> index 82acff9bbeea476d..73d81d0bc0ec6d38 100644\n> >>> --- a/src/cam/options.cpp\n> >>> +++ b/src/cam/options.cpp\n> >>> @@ -143,7 +143,8 @@ void OptionsParser::usage()\n> >>>  \t\t};\n> >>>  \n> >>>  \t\tif (option.argument != ArgumentNone) {\n> >>> -\t\t\targument += std::string(\" \");\n> >>> +\t\t\targument += option.argument == ArgumentOptional ?\n> >>> +\t\t\t\t\"=\" : \" \";\n> >>>  \t\t\tif (option.argument == ArgumentOptional)\n> >>>  \t\t\t\targument += \"[\";\n> >>>  \t\t\targument += option.argumentName;\n> >>\n> >> This will output\n> >>\n> >> \t-f, --foo value\n> >>\n> >> for mandatory arguments, and\n> >>\n> >> \t-f, --foo=[value]\n> >>\n> >> for optional arguments. If we want to print the =, shouldn't it be\n> >> --foo[=value] ?\n> > \n> > It should of course be --foo[=value], will fix.\n> > \n> >> And how should we handle the case where no long option\n> >> is available, with this patch -f=[value] would be printed, which isn't\n> >> correct I think.\n> > \n> > Good point, for optional short arguments the syntax would be -fvalue.  \n> > Would it make sens to print both short and long syntax in the usage?\n> > \n> >     -f[value], --foo[=value]\n> > \n> > Let me know what you think and I send a v2.\n> \n> Is it difficult to accept a space or an = separator on the arguments?\n\nI think so, this is the default behavior of getopt_long() so without \nreimplementing that I think we are stuck with it. Maybe we can look into \nthis once we are a bit further along and use the default behavior for \nnow?\n\n> \n> \n> \n> -- \n> Regards\n> --\n> Kieran","headers":{"Return-Path":"<niklas.soderlund@ragnatech.se>","Received":["from mail-lf1-x143.google.com (mail-lf1-x143.google.com\n\t[IPv6:2a00:1450:4864:20::143])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 59A1A60C7F\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 25 Jan 2019 14:35:02 +0100 (CET)","by mail-lf1-x143.google.com with SMTP id a8so6939238lfk.5\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 25 Jan 2019 05:35:02 -0800 (PST)","from localhost (89-233-230-99.cust.bredband2.com. [89.233.230.99])\n\tby smtp.gmail.com with ESMTPSA id\n\ty10-v6sm1468375ljy.65.2019.01.25.05.34.45\n\t(version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256);\n\tFri, 25 Jan 2019 05:34:45 -0800 (PST)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=ragnatech-se.20150623.gappssmtp.com; s=20150623;\n\th=date:from:to:cc:subject:message-id:references:mime-version\n\t:content-disposition:content-transfer-encoding:in-reply-to\n\t:user-agent; bh=Sr1N7PesrV/Xp9D8milPnxK/cv04inv0QFT2OxXeAOA=;\n\tb=b9Lp181BPQfFEdRvo8JZP5DbXLutfmoTOzj1K2BPCE0tPhMaUG5FcgVfm1SpxC9Ru3\n\t9CHVUcn84el2MAYm4fYZCgAqgE2ZQwGIlNqq2EK36tSoGltsa/IWqsQUmCs+6kg83yAi\n\tWEcqvm2qMM+CafABVspnN+G9u1ndLZSYqeZ5FpVMb9z7hcLQAwI8qEw/w6ordXS2YJsL\n\tEoshe1b0v7L+ScjqSvlbx3Tq9sozt76PTtbbytIWwb3Wl7UfVr9zlcNCt+enjZNEhroS\n\tWqOv6+uh8MOkC+Hri0ZKdDrfT98op2acBGWN/6ynXSVAIMEJzqyzJxi3sTJjhEzb5LFw\n\tbnEQ==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:date:from:to:cc:subject:message-id:references\n\t:mime-version:content-disposition:content-transfer-encoding\n\t:in-reply-to:user-agent;\n\tbh=Sr1N7PesrV/Xp9D8milPnxK/cv04inv0QFT2OxXeAOA=;\n\tb=kYF/98/ytQ+tuj+finD2VkO1+OaxtQ0LbO/pUYbvGPzhmIVLJ/FYqMvsRyEG/QXZI/\n\tvgItrr1gn+3oHAJ4iry8MEPAbNTh/+sk56SaCAVprOPX6qZZcrLh+86/fTA7t8YSS5g8\n\ti//t3ZkRyDfzYzPZroCr5RPAnhXXs+fJ8+RHmUxNNFwJAJt65v4AayBlONZ3LVCP4gcm\n\ttzBOPvwm85fNIys6ZeqnJcPZKJlHbBYorO6fVbny+CqU24IKI5HAcSF86Q81wx5gveTQ\n\tw3Cd6lDg+4vVQKozdmF0g1O/jz3PjdePMZD+3atXtE+1xPU/0JTOWENF0HjdmysKrhKY\n\tdQtQ==","X-Gm-Message-State":"AJcUukdiIA/MUyVvnjhh/9vF5RTOUAiKNBfXbTDT6EZgx8lRthfMNfOL\n\tcBcIaKKsh2QygHnM2QhZ5yqJe3GU5Ds=","X-Google-Smtp-Source":"ALg8bN5mLVZPv8nMu9JqM8TwSmg6MKOUO2XD/2W1kLCCG8qubdMQR4EVROn8hHBiT+8i4Otaqsf0Lg==","X-Received":"by 2002:a19:9508:: with SMTP id x8mr8496215lfd.112.1548423286458;\n\tFri, 25 Jan 2019 05:34:46 -0800 (PST)","Date":"Fri, 25 Jan 2019 14:34:45 +0100","From":"Niklas =?iso-8859-1?q?S=F6derlund?= <niklas.soderlund@ragnatech.se>","To":"Kieran Bingham <kieran.bingham@ideasonboard.com>","Cc":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>,\n\tlibcamera-devel@lists.libcamera.org","Message-ID":"<20190125133444.GJ4127@bigcity.dyn.berto.se>","References":"<20190124232311.29636-1-niklas.soderlund@ragnatech.se>\n\t<20190125110134.GC2934@pendragon.ideasonboard.com>\n\t<20190125112325.GI4127@bigcity.dyn.berto.se>\n\t<2146b244-fc4c-7c73-9209-b9209355948a@ideasonboard.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=iso-8859-1","Content-Disposition":"inline","Content-Transfer-Encoding":"8bit","In-Reply-To":"<2146b244-fc4c-7c73-9209-b9209355948a@ideasonboard.com>","User-Agent":"Mutt/1.10.1 (2018-07-13)","Subject":"Re: [libcamera-devel] [PATCH] cam: options: optional arguments\n\tneeds to be specified as --foo=bar","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.23","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","X-List-Received-Date":"Fri, 25 Jan 2019 13:35:02 -0000"}},{"id":591,"web_url":"https://patchwork.libcamera.org/comment/591/","msgid":"<20190125144441.GA4320@pendragon.ideasonboard.com>","date":"2019-01-25T14:44:41","subject":"Re: [libcamera-devel] [PATCH] cam: options: optional arguments\n\tneeds to be specified as --foo=bar","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"Hi Kieran,\n\nOn Fri, Jan 25, 2019 at 12:23:25PM +0100, Niklas Söderlund wrote:\n> On 2019-01-25 13:01:34 +0200, Laurent Pinchart wrote:\n> > On Fri, Jan 25, 2019 at 12:23:11AM +0100, Niklas Söderlund wrote:\n> > > It's not state in the documentation but optional arguments needs to be\n> > > specified using as '--foo=bar' instead of '--foo bar', otherwise the\n> > > value is not propagated to optarg during argument parsing. Update the\n> > > usage printing helper to reflect this requirement.\n> > > \n> > > Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>\n> > > ---\n> > >  src/cam/options.cpp | 3 ++-\n> > >  1 file changed, 2 insertions(+), 1 deletion(-)\n> > > \n> > > diff --git a/src/cam/options.cpp b/src/cam/options.cpp\n> > > index 82acff9bbeea476d..73d81d0bc0ec6d38 100644\n> > > --- a/src/cam/options.cpp\n> > > +++ b/src/cam/options.cpp\n> > > @@ -143,7 +143,8 @@ void OptionsParser::usage()\n> > >  \t\t};\n> > >  \n> > >  \t\tif (option.argument != ArgumentNone) {\n> > > -\t\t\targument += std::string(\" \");\n> > > +\t\t\targument += option.argument == ArgumentOptional ?\n> > > +\t\t\t\t\"=\" : \" \";\n> > >  \t\t\tif (option.argument == ArgumentOptional)\n> > >  \t\t\t\targument += \"[\";\n> > >  \t\t\targument += option.argumentName;\n> > \n> > This will output\n> > \n> > \t-f, --foo value\n> > \n> > for mandatory arguments, and\n> > \n> > \t-f, --foo=[value]\n> > \n> > for optional arguments. If we want to print the =, shouldn't it be\n> > --foo[=value] ?\n> \n> It should of course be --foo[=value], will fix.\n> \n> > And how should we handle the case where no long option\n> > is available, with this patch -f=[value] would be printed, which isn't\n> > correct I think.\n> \n> Good point, for optional short arguments the syntax would be -fvalue.  \n> Would it make sens to print both short and long syntax in the usage?\n> \n>     -f[value], --foo[=value]\n> \n> Let me know what you think and I send a v2.\n\nThat would make sense, but then we should also write\n\n    -f value, --foo value\n\nand we will lose the nice alignment of all long arguments :-( I'm not\nsure what's best.","headers":{"Return-Path":"<laurent.pinchart@ideasonboard.com>","Received":["from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 9B31060B1D\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 25 Jan 2019 15:44:42 +0100 (CET)","from pendragon.ideasonboard.com (unknown\n\t[IPv6:2a02:a03f:4499:2700:1060:1d4c:d6a:8e80])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 1A0B8325;\n\tFri, 25 Jan 2019 15:44:42 +0100 (CET)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1548427482;\n\tbh=dzFKI2ouqVEtD62oMQOJYldPXQeeO9twsWORhV/mkos=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=GAIMmf7/mhVK3SE++iOK9F7l5+kumh2pBRVctd+sJfVnX8Go+leD7T3VcP4PF+whQ\n\tzgaSNQzEszGcop8O1pog8NBne++JiuTuPo7KavsDEJScWSZYnf7jKwS25FZYkosn9u\n\tYZhH8M1n3gdx7mfPe+C7D4I5e2GVYAExALTSGR1I=","Date":"Fri, 25 Jan 2019 16:44:41 +0200","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"Niklas =?utf-8?q?S=C3=B6derlund?= <niklas.soderlund@ragnatech.se>","Cc":"libcamera-devel@lists.libcamera.org","Message-ID":"<20190125144441.GA4320@pendragon.ideasonboard.com>","References":"<20190124232311.29636-1-niklas.soderlund@ragnatech.se>\n\t<20190125110134.GC2934@pendragon.ideasonboard.com>\n\t<20190125112325.GI4127@bigcity.dyn.berto.se>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","Content-Transfer-Encoding":"8bit","In-Reply-To":"<20190125112325.GI4127@bigcity.dyn.berto.se>","User-Agent":"Mutt/1.10.1 (2018-07-13)","Subject":"Re: [libcamera-devel] [PATCH] cam: options: optional arguments\n\tneeds to be specified as --foo=bar","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.23","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","X-List-Received-Date":"Fri, 25 Jan 2019 14:44:42 -0000"}},{"id":600,"web_url":"https://patchwork.libcamera.org/comment/600/","msgid":"<20190125154936.GN4127@bigcity.dyn.berto.se>","date":"2019-01-25T15:49:36","subject":"Re: [libcamera-devel] [PATCH] cam: options: optional arguments\n\tneeds to be specified as --foo=bar","submitter":{"id":5,"url":"https://patchwork.libcamera.org/api/people/5/","name":"Niklas Söderlund","email":"niklas.soderlund@ragnatech.se"},"content":"Hello,\n\nOn 2019-01-25 16:44:41 +0200, Laurent Pinchart wrote:\n> Hi Kieran,\n> \n> On Fri, Jan 25, 2019 at 12:23:25PM +0100, Niklas Söderlund wrote:\n> > On 2019-01-25 13:01:34 +0200, Laurent Pinchart wrote:\n> > > On Fri, Jan 25, 2019 at 12:23:11AM +0100, Niklas Söderlund wrote:\n> > > > It's not state in the documentation but optional arguments needs to be\n> > > > specified using as '--foo=bar' instead of '--foo bar', otherwise the\n> > > > value is not propagated to optarg during argument parsing. Update the\n> > > > usage printing helper to reflect this requirement.\n> > > > \n> > > > Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>\n> > > > ---\n> > > >  src/cam/options.cpp | 3 ++-\n> > > >  1 file changed, 2 insertions(+), 1 deletion(-)\n> > > > \n> > > > diff --git a/src/cam/options.cpp b/src/cam/options.cpp\n> > > > index 82acff9bbeea476d..73d81d0bc0ec6d38 100644\n> > > > --- a/src/cam/options.cpp\n> > > > +++ b/src/cam/options.cpp\n> > > > @@ -143,7 +143,8 @@ void OptionsParser::usage()\n> > > >  \t\t};\n> > > >  \n> > > >  \t\tif (option.argument != ArgumentNone) {\n> > > > -\t\t\targument += std::string(\" \");\n> > > > +\t\t\targument += option.argument == ArgumentOptional ?\n> > > > +\t\t\t\t\"=\" : \" \";\n> > > >  \t\t\tif (option.argument == ArgumentOptional)\n> > > >  \t\t\t\targument += \"[\";\n> > > >  \t\t\targument += option.argumentName;\n> > > \n> > > This will output\n> > > \n> > > \t-f, --foo value\n> > > \n> > > for mandatory arguments, and\n> > > \n> > > \t-f, --foo=[value]\n> > > \n> > > for optional arguments. If we want to print the =, shouldn't it be\n> > > --foo[=value] ?\n> > \n> > It should of course be --foo[=value], will fix.\n> > \n> > > And how should we handle the case where no long option\n> > > is available, with this patch -f=[value] would be printed, which isn't\n> > > correct I think.\n> > \n> > Good point, for optional short arguments the syntax would be -fvalue.  \n> > Would it make sens to print both short and long syntax in the usage?\n> > \n> >     -f[value], --foo[=value]\n> > \n> > Let me know what you think and I send a v2.\n> \n> That would make sense, but then we should also write\n> \n>     -f value, --foo value\n> \n> and we will lose the nice alignment of all long arguments :-( I'm not\n> sure what's best.\n\nTo move forward with this I would suggest,\n\n    -f, --foo[=value]\n\nRational being that if you use -f you get the default behavior and if \nyou want to specify the optional argument you can use the long option. I \nwould however not go out of the way to make -fvalue fail argument \nparsing. Then when we create a man page for the tool we can specify both \nversions in detail.\n\nWould this work for everyone?\n\n> \n> -- \n> Regards,\n> \n> Laurent Pinchart","headers":{"Return-Path":"<niklas.soderlund@ragnatech.se>","Received":["from mail-lj1-x241.google.com (mail-lj1-x241.google.com\n\t[IPv6:2a00:1450:4864:20::241])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 4E49760B1D\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 25 Jan 2019 16:49:38 +0100 (CET)","by mail-lj1-x241.google.com with SMTP id x85-v6so8780321ljb.2\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 25 Jan 2019 07:49:38 -0800 (PST)","from localhost (89-233-230-99.cust.bredband2.com. [89.233.230.99])\n\tby smtp.gmail.com with ESMTPSA id\n\ta127sm1541799lfe.73.2019.01.25.07.49.36\n\t(version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256);\n\tFri, 25 Jan 2019 07:49:36 -0800 (PST)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=ragnatech-se.20150623.gappssmtp.com; s=20150623;\n\th=date:from:to:cc:subject:message-id:references:mime-version\n\t:content-disposition:content-transfer-encoding:in-reply-to\n\t:user-agent; bh=tHoa3y4VpOI8r5f1Qql7b+raeissfio9Mg2tiID3bP0=;\n\tb=C4mqTUgjdyCqwKRMS9ZdQ+XLxK+uEp3CYPj8EuXVFCKm3pAdf72D5OEjRVDnG8shbG\n\taWKWbBSmeZlhjTsz/ZRZctQgcT9geFKf+Y+MJexZA1uo+NIdFVFU2dKvSil19RELOMVb\n\tg8JTYidPQsOo84XC8iAlq3fHra8h8f9wI2aYZO777VS1hcWTJVXMQA40SO6YEy/fw20I\n\tyYQhS9z8QE9abKGwZQdqHGF+VfKOi34aqtS7R87+9OYzozuVv8Nl+i5UsrY0g45OPZBM\n\ts8jP4G0FepXV66Q2v4l/KVsbaMa0zplD5nVKZLQX9C27ZwIoFfSZY+pwD9g2CuFSmMvH\n\t8hhQ==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:date:from:to:cc:subject:message-id:references\n\t:mime-version:content-disposition:content-transfer-encoding\n\t:in-reply-to:user-agent;\n\tbh=tHoa3y4VpOI8r5f1Qql7b+raeissfio9Mg2tiID3bP0=;\n\tb=HmC3RsBxJ7pDAZ9hHGs86cA0rpk3ZPNMHmdURJcqZMxtw984AA2t1wI+mUQqfaZ1AV\n\thvAh0LXDZ2lWWY5cpWsS6tF0Ze3AyCGwUVRxhCoaQdG1hyLOV4f6ZxR183BO3gkn/aNP\n\tznjxmFkwPHwCPk+FSeW4t64hHLJEMnDbE80lkUJZHis38ZHRVD3RzGnk/6gEDE2eZz/B\n\tqGqsLWz5GxzDWLx9WTWxSCZhC8XxevV4CVtqFWMAPIX3+FZv5uz0GZQGWIN7MgbCL5pj\n\tmZXBSiGbd+y7gnAhpJt007deZ/LvsY7eiKu738wxZx0pW/9JAVog0fIDftA7mZ6mDSUF\n\tj3OQ==","X-Gm-Message-State":"AJcUukem+8ysWA9r74TtEAk2DgPV6JE70kqIC4qFKPOfpCscltSNhlzt\n\thjbA4J136arX5wOC8iNafw71VUgdgSg=","X-Google-Smtp-Source":"ALg8bN5MGEBTvudFnFNrXzhcczTUcxPGaH6a8XC/rhz54gmyNjq/vEos1bIc6a3PFzt3L5JwN75ohw==","X-Received":"by 2002:a2e:9715:: with SMTP id\n\tr21-v6mr9663440lji.30.1548431377511; \n\tFri, 25 Jan 2019 07:49:37 -0800 (PST)","Date":"Fri, 25 Jan 2019 16:49:36 +0100","From":"Niklas =?iso-8859-1?q?S=F6derlund?= <niklas.soderlund@ragnatech.se>","To":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","Cc":"libcamera-devel@lists.libcamera.org","Message-ID":"<20190125154936.GN4127@bigcity.dyn.berto.se>","References":"<20190124232311.29636-1-niklas.soderlund@ragnatech.se>\n\t<20190125110134.GC2934@pendragon.ideasonboard.com>\n\t<20190125112325.GI4127@bigcity.dyn.berto.se>\n\t<20190125144441.GA4320@pendragon.ideasonboard.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=iso-8859-1","Content-Disposition":"inline","Content-Transfer-Encoding":"8bit","In-Reply-To":"<20190125144441.GA4320@pendragon.ideasonboard.com>","User-Agent":"Mutt/1.10.1 (2018-07-13)","Subject":"Re: [libcamera-devel] [PATCH] cam: options: optional arguments\n\tneeds to be specified as --foo=bar","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.23","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","X-List-Received-Date":"Fri, 25 Jan 2019 15:49:38 -0000"}},{"id":603,"web_url":"https://patchwork.libcamera.org/comment/603/","msgid":"<20190125160123.GI4320@pendragon.ideasonboard.com>","date":"2019-01-25T16:01:23","subject":"Re: [libcamera-devel] [PATCH] cam: options: optional arguments\n\tneeds to be specified as --foo=bar","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"Hi Niklas,\n\nOn Fri, Jan 25, 2019 at 04:49:36PM +0100, Niklas Söderlund wrote:\n> On 2019-01-25 16:44:41 +0200, Laurent Pinchart wrote:\n> > On Fri, Jan 25, 2019 at 12:23:25PM +0100, Niklas Söderlund wrote:\n> >> On 2019-01-25 13:01:34 +0200, Laurent Pinchart wrote:\n> >>> On Fri, Jan 25, 2019 at 12:23:11AM +0100, Niklas Söderlund wrote:\n> >>>> It's not state in the documentation but optional arguments needs to be\n> >>>> specified using as '--foo=bar' instead of '--foo bar', otherwise the\n> >>>> value is not propagated to optarg during argument parsing. Update the\n> >>>> usage printing helper to reflect this requirement.\n> >>>> \n> >>>> Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>\n> >>>> ---\n> >>>>  src/cam/options.cpp | 3 ++-\n> >>>>  1 file changed, 2 insertions(+), 1 deletion(-)\n> >>>> \n> >>>> diff --git a/src/cam/options.cpp b/src/cam/options.cpp\n> >>>> index 82acff9bbeea476d..73d81d0bc0ec6d38 100644\n> >>>> --- a/src/cam/options.cpp\n> >>>> +++ b/src/cam/options.cpp\n> >>>> @@ -143,7 +143,8 @@ void OptionsParser::usage()\n> >>>>  \t\t};\n> >>>>  \n> >>>>  \t\tif (option.argument != ArgumentNone) {\n> >>>> -\t\t\targument += std::string(\" \");\n> >>>> +\t\t\targument += option.argument == ArgumentOptional ?\n> >>>> +\t\t\t\t\"=\" : \" \";\n> >>>>  \t\t\tif (option.argument == ArgumentOptional)\n> >>>>  \t\t\t\targument += \"[\";\n> >>>>  \t\t\targument += option.argumentName;\n> >>> \n> >>> This will output\n> >>> \n> >>> \t-f, --foo value\n> >>> \n> >>> for mandatory arguments, and\n> >>> \n> >>> \t-f, --foo=[value]\n> >>> \n> >>> for optional arguments. If we want to print the =, shouldn't it be\n> >>> --foo[=value] ?\n> >> \n> >> It should of course be --foo[=value], will fix.\n> >> \n> >>> And how should we handle the case where no long option\n> >>> is available, with this patch -f=[value] would be printed, which isn't\n> >>> correct I think.\n> >> \n> >> Good point, for optional short arguments the syntax would be -fvalue.  \n> >> Would it make sens to print both short and long syntax in the usage?\n> >> \n> >>     -f[value], --foo[=value]\n> >> \n> >> Let me know what you think and I send a v2.\n> > \n> > That would make sense, but then we should also write\n> > \n> >     -f value, --foo value\n> > \n> > and we will lose the nice alignment of all long arguments :-( I'm not\n> > sure what's best.\n> \n> To move forward with this I would suggest,\n> \n>     -f, --foo[=value]\n> \n> Rational being that if you use -f you get the default behavior and if \n> you want to specify the optional argument you can use the long option. I \n> would however not go out of the way to make -fvalue fail argument \n> parsing. Then when we create a man page for the tool we can specify both \n> versions in detail.\n> \n> Would this work for everyone?\n\nWorks for me.","headers":{"Return-Path":"<laurent.pinchart@ideasonboard.com>","Received":["from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 2818A60B1D\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 25 Jan 2019 17:01:28 +0100 (CET)","from pendragon.ideasonboard.com (unknown\n\t[IPv6:2a02:a03f:4499:2700:1060:1d4c:d6a:8e80])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 962BD325;\n\tFri, 25 Jan 2019 17:01:23 +0100 (CET)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1548432083;\n\tbh=zNqU69Jd9xp7oCqAy4YsKsBrghuBgmYRO07Qw+fSEDQ=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=s9QXclzkfvmH6DnaBvkPdS2+Tyx9R/U44vNln9Db0Xsj4JWNBV3fb6NEP0EjxoGrp\n\t5fAcc2r/rSeTZedkQKMAajJ4e+83s3yQYMjBWPD9LJvhrGSug9h4mUhuApQtolHeEN\n\tYhOdoIB7nU8ph685VM6pX5AP6MQQPA8Jy2JckGpI=","Date":"Fri, 25 Jan 2019 18:01:23 +0200","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"Niklas =?utf-8?q?S=C3=B6derlund?= <niklas.soderlund@ragnatech.se>","Cc":"libcamera-devel@lists.libcamera.org","Message-ID":"<20190125160123.GI4320@pendragon.ideasonboard.com>","References":"<20190124232311.29636-1-niklas.soderlund@ragnatech.se>\n\t<20190125110134.GC2934@pendragon.ideasonboard.com>\n\t<20190125112325.GI4127@bigcity.dyn.berto.se>\n\t<20190125144441.GA4320@pendragon.ideasonboard.com>\n\t<20190125154936.GN4127@bigcity.dyn.berto.se>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","Content-Transfer-Encoding":"8bit","In-Reply-To":"<20190125154936.GN4127@bigcity.dyn.berto.se>","User-Agent":"Mutt/1.10.1 (2018-07-13)","Subject":"Re: [libcamera-devel] [PATCH] cam: options: optional arguments\n\tneeds to be specified as --foo=bar","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.23","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","X-List-Received-Date":"Fri, 25 Jan 2019 16:01:28 -0000"}}]