You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by ba...@apache.org on 2006/09/10 09:40:30 UTC
svn commit: r441922 - in /jakarta/commons/sandbox/finder/trunk: pom.xml
src/java/org/apache/commons/finder/Find.java
Author: bayard
Date: Sun Sep 10 00:40:29 2006
New Revision: 441922
URL: http://svn.apache.org/viewvc?view=rev&rev=441922
Log:
Adding dependency on commons-cli for the purpose of a command line find implementation, and a Find class to put said implementation in, though it barely has anything in it to start with.
Added:
jakarta/commons/sandbox/finder/trunk/src/java/org/apache/commons/finder/Find.java
Modified:
jakarta/commons/sandbox/finder/trunk/pom.xml
Modified: jakarta/commons/sandbox/finder/trunk/pom.xml
URL: http://svn.apache.org/viewvc/jakarta/commons/sandbox/finder/trunk/pom.xml?view=diff&rev=441922&r1=441921&r2=441922
==============================================================================
--- jakarta/commons/sandbox/finder/trunk/pom.xml (original)
+++ jakarta/commons/sandbox/finder/trunk/pom.xml Sun Sep 10 00:40:29 2006
@@ -14,9 +14,14 @@
<dependencies>
<dependency>
- <groupId>commons-io</groupId>
+ <groupId>org.apache.commons</groupId>
<artifactId>commons-io</artifactId>
- <version>SNAPSHOT</version>
+ <version>1.3-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.commons</groupId>
+ <artifactId>commons-cli</artifactId>
+ <version>2.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>junit</groupId>
Added: jakarta/commons/sandbox/finder/trunk/src/java/org/apache/commons/finder/Find.java
URL: http://svn.apache.org/viewvc/jakarta/commons/sandbox/finder/trunk/src/java/org/apache/commons/finder/Find.java?view=auto&rev=441922
==============================================================================
--- jakarta/commons/sandbox/finder/trunk/src/java/org/apache/commons/finder/Find.java (added)
+++ jakarta/commons/sandbox/finder/trunk/src/java/org/apache/commons/finder/Find.java Sun Sep 10 00:40:29 2006
@@ -0,0 +1,58 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.commons.finder;
+
+import org.apache.commons.cli2.*;
+import org.apache.commons.cli2.builder.*;
+import org.apache.commons.cli2.commandline.Parser;
+
+public class Find {
+
+ public static void main(String[] args) throws OptionException {
+ DefaultOptionBuilder obuilder = new DefaultOptionBuilder();
+ ArgumentBuilder abuilder = new ArgumentBuilder();
+ GroupBuilder gbuilder = new GroupBuilder();
+
+ Option type =
+ obuilder
+ .withShortName("type")
+ .withDescription("True if the file is of the specified type.")
+ .withArgument(
+ abuilder
+ .withName("type-flag")
+ .withMinimum(1)
+ .withMaximum(1)
+ .create()
+ )
+ .create();
+
+ Group options =
+ gbuilder
+ .withName("options")
+ .withOption(type)
+ .create();
+
+ Parser parser = new Parser();
+ parser.setGroup(options);
+ CommandLine cl = parser.parse(args);
+
+ if(cl.hasOption(type)) {
+ System.out.println("USE TYPE: " + cl.getValue(type));
+ }
+ }
+
+}
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org