2 * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
8 package org.opendaylight.yangtools.yang.validation.tool;
11 import java.net.URISyntaxException;
12 import net.sourceforge.argparse4j.ArgumentParsers;
13 import net.sourceforge.argparse4j.annotation.Arg;
14 import net.sourceforge.argparse4j.inf.ArgumentParser;
18 @Arg(dest = "yang-source-dir")
19 private File yangSourceDir;
21 static ArgumentParser getParser() throws URISyntaxException {
22 final ArgumentParser parser = ArgumentParsers.newArgumentParser("jar_file_name");
23 parser.description("Validation Tool for Yang Models")
26 parser.addArgumentGroup("Required arguments")
27 .addArgument("--yang-source-dir")
30 .help("directory containing yang models which will be parsed")
31 .dest("yang-source-dir")
37 public boolean isValid() {
38 if (yangSourceDir == null) {
41 if (!yangSourceDir.exists()) {
42 System.err.println("Yang source directory has to exist");
45 if (!yangSourceDir.canRead()) {
46 System.err.println("Yang source directory has to be readable");
49 if (yangSourceDir.list().length == 0) {
50 System.err.printf("Yang source directory '%s' does't contain any model%n", yangSourceDir.getPath());
57 public File getYangSourceDir() {