Return-Path: X-Original-To: apmail-commons-user-archive@www.apache.org Delivered-To: apmail-commons-user-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 53A06E16A for ; Fri, 1 Feb 2013 15:04:11 +0000 (UTC) Received: (qmail 24017 invoked by uid 500); 1 Feb 2013 15:04:10 -0000 Delivered-To: apmail-commons-user-archive@commons.apache.org Received: (qmail 23664 invoked by uid 500); 1 Feb 2013 15:04:08 -0000 Mailing-List: contact user-help@commons.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "Commons Users List" Delivered-To: mailing list user@commons.apache.org Received: (qmail 22930 invoked by uid 99); 1 Feb 2013 15:04:07 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 01 Feb 2013 15:04:07 +0000 X-ASF-Spam-Status: No, hits=1.5 required=5.0 tests=HTML_MESSAGE,RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of greg.d.thomas@gmail.com designates 209.85.214.180 as permitted sender) Received: from [209.85.214.180] (HELO mail-ob0-f180.google.com) (209.85.214.180) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 01 Feb 2013 15:03:59 +0000 Received: by mail-ob0-f180.google.com with SMTP id ef5so4049707obb.25 for ; Fri, 01 Feb 2013 07:03:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:x-received:date:message-id:subject:from:to :content-type; bh=/ElvhnhegaUY7fDNDWvEuqOtiuxp139iM+K2ONvCrr4=; b=ubKnQxBvh0+IutHzkj06W6TCYxLdsUOi6wnJct5D0cP9oc+P4ovCLLbjrp48A4+BWG l70T61P/eeKAn/6q2KICj1bOXbQR7biR3Gfh3TMjfKp0QZHsCC42NpQ1wRCBfSCDEz/r cZsMzh9lDc3wh/5SF/xQWyxGmOd0Ho8HFZV2GXcktrxdjycJr8YlVMFKclQ8QG82GCsO jpmg2Fc3YbSWh3BmiZesmtQvz56N8HcRCzJzqDgBUbj+3BO/4xKOlialMtKIpIWHTG47 vehPa0++WgKGHQLxEDBEn5S9gpQLE5A817vwZbGGbnnk+RiZwf5vfxIEqA99Wm1n3GhQ Nk+w== MIME-Version: 1.0 X-Received: by 10.60.3.8 with SMTP id 8mr9785187oey.101.1359731018854; Fri, 01 Feb 2013 07:03:38 -0800 (PST) Received: by 10.60.171.40 with HTTP; Fri, 1 Feb 2013 07:03:38 -0800 (PST) Date: Fri, 1 Feb 2013 15:03:38 +0000 Message-ID: Subject: [CLI] - withValueSeparator() usage From: Greg Thomas To: Commons Users List Content-Type: multipart/alternative; boundary=e89a8fb202485e6fc704d4ab0c4a X-Virus-Checked: Checked by ClamAV on apache.org --e89a8fb202485e6fc704d4ab0c4a Content-Type: text/plain; charset=ISO-8859-1 I'm struggling on how to use the withValueSeparator() option; Taking the following piece of code ... Options options = new Options(); Option columns = OptionBuilder .hasArg() .withArgName("CSV columns") .withValueSeparator(',') .withDescription("Specify the comma separated list of columns") .create("columns"); options.addOption(columns); CommandLineParser parser = new GnuParser(); CommandLine line = parser.parse(options, new String[]{ "-columns", "a,b,c"}); System.out.println("hasOption:" + line.hasOption("columns")); System.out.println("column count:" + line.getOptionValues("columns").length); I woudl expect it to print out something like: hasOption:true column count:3 whereas in fact I'm getting hasOption:true column count:1 i.e. despite me specifying ',' as a value separator, getOptionValues() is returning a array that is one element in size, containing "a,b,c" instead of three elements, each containing a single letter. I'm missing something - what it is? Thanks, Greg --e89a8fb202485e6fc704d4ab0c4a--