Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
doujutun3207
flink
提交
93eadca7
F
flink
项目概览
doujutun3207
/
flink
与 Fork 源项目一致
从无法访问的项目Fork
通知
24
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
F
flink
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
93eadca7
编写于
12月 24, 2014
作者:
A
Alexander Alexandrov
提交者:
Stephan Ewen
1月 06, 2015
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[FLINK-1027] [cli] Added support for '--' and '-' prefixed tokens in CLI program arguments.
This closes #278
上级
0190dd24
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
63 addition
and
54 deletion
+63
-54
flink-clients/src/main/java/org/apache/flink/client/CliFrontend.java
...ts/src/main/java/org/apache/flink/client/CliFrontend.java
+1
-1
flink-clients/src/test/java/org/apache/flink/client/CliFrontendPackageProgramTest.java
...rg/apache/flink/client/CliFrontendPackageProgramTest.java
+56
-52
flink-clients/src/test/java/org/apache/flink/client/testjar/WordCount.java
.../test/java/org/apache/flink/client/testjar/WordCount.java
+6
-1
未找到文件。
flink-clients/src/main/java/org/apache/flink/client/CliFrontend.java
浏览文件 @
93eadca7
...
@@ -278,7 +278,7 @@ public class CliFrontend {
...
@@ -278,7 +278,7 @@ public class CliFrontend {
// Parse command line options
// Parse command line options
CommandLine
line
;
CommandLine
line
;
try
{
try
{
line
=
parser
.
parse
(
RUN_OPTIONS
,
args
,
fals
e
);
line
=
parser
.
parse
(
RUN_OPTIONS
,
args
,
tru
e
);
evaluateGeneralOptions
(
line
);
evaluateGeneralOptions
(
line
);
}
}
catch
(
MissingOptionException
e
)
{
catch
(
MissingOptionException
e
)
{
...
...
flink-clients/src/test/java/org/apache/flink/client/CliFrontendPackageProgramTest.java
浏览文件 @
93eadca7
...
@@ -32,7 +32,6 @@ import static org.mockito.Mockito.when;
...
@@ -32,7 +32,6 @@ import static org.mockito.Mockito.when;
import
org.apache.commons.cli.CommandLine
;
import
org.apache.commons.cli.CommandLine
;
import
org.apache.commons.cli.Options
;
import
org.apache.commons.cli.Options
;
import
org.apache.commons.cli.PosixParser
;
import
org.apache.commons.cli.PosixParser
;
import
org.apache.flink.client.CliFrontend
;
import
org.apache.flink.client.program.Client
;
import
org.apache.flink.client.program.Client
;
import
org.apache.flink.client.program.PackagedProgram
;
import
org.apache.flink.client.program.PackagedProgram
;
import
org.apache.flink.client.program.ProgramInvocationException
;
import
org.apache.flink.client.program.ProgramInvocationException
;
...
@@ -54,8 +53,8 @@ public class CliFrontendPackageProgramTest {
...
@@ -54,8 +53,8 @@ public class CliFrontendPackageProgramTest {
@Test
@Test
public
void
testNonExistingJarFile
()
{
public
void
testNonExistingJarFile
()
{
try
{
try
{
String
[]
arguments
=
{
"-j"
,
"/some/none/existing/path"
,
"-a"
,
"
plenty"
,
"of"
,
"arguments
"
};
String
[]
arguments
=
{
"-j"
,
"/some/none/existing/path"
,
"-a"
,
"
--verbose"
,
"true"
,
"arg1"
,
"arg2
"
};
CommandLine
line
=
new
PosixParser
().
parse
(
CliFrontend
.
getProgramSpecificOptions
(
new
Options
()),
arguments
,
fals
e
);
CommandLine
line
=
new
PosixParser
().
parse
(
CliFrontend
.
getProgramSpecificOptions
(
new
Options
()),
arguments
,
tru
e
);
CliFrontend
frontend
=
new
CliFrontend
();
CliFrontend
frontend
=
new
CliFrontend
();
Object
result
=
frontend
.
buildProgram
(
line
);
Object
result
=
frontend
.
buildProgram
(
line
);
...
@@ -71,8 +70,8 @@ public class CliFrontendPackageProgramTest {
...
@@ -71,8 +70,8 @@ public class CliFrontendPackageProgramTest {
@Test
@Test
public
void
testFileNotJarFile
()
{
public
void
testFileNotJarFile
()
{
try
{
try
{
String
[]
arguments
=
{
"-j"
,
getNonJarFilePath
(),
"-a"
,
"
plenty"
,
"of"
,
"arguments
"
};
String
[]
arguments
=
{
"-j"
,
getNonJarFilePath
(),
"-a"
,
"
--verbose"
,
"true"
,
"arg1"
,
"arg2
"
};
CommandLine
line
=
new
PosixParser
().
parse
(
CliFrontend
.
getProgramSpecificOptions
(
new
Options
()),
arguments
,
fals
e
);
CommandLine
line
=
new
PosixParser
().
parse
(
CliFrontend
.
getProgramSpecificOptions
(
new
Options
()),
arguments
,
tru
e
);
CliFrontend
frontend
=
new
CliFrontend
();
CliFrontend
frontend
=
new
CliFrontend
();
Object
result
=
frontend
.
buildProgram
(
line
);
Object
result
=
frontend
.
buildProgram
(
line
);
...
@@ -88,16 +87,16 @@ public class CliFrontendPackageProgramTest {
...
@@ -88,16 +87,16 @@ public class CliFrontendPackageProgramTest {
@Test
@Test
public
void
testVariantWithExplicitJarAndArgumentsOption
()
{
public
void
testVariantWithExplicitJarAndArgumentsOption
()
{
try
{
try
{
String
[]
parameters
=
{
"-j"
,
getTestJarPath
(),
"-a"
,
"some"
,
"program"
,
"arguments
"
};
String
[]
arguments
=
{
"-j"
,
getTestJarPath
(),
"-a"
,
"--verbose"
,
"true"
,
"arg1"
,
"arg2
"
};
CommandLine
line
=
new
PosixParser
().
parse
(
CliFrontend
.
getProgramSpecificOptions
(
new
Options
()),
parameters
,
fals
e
);
CommandLine
line
=
new
PosixParser
().
parse
(
CliFrontend
.
getProgramSpecificOptions
(
new
Options
()),
arguments
,
tru
e
);
CliFrontend
frontend
=
new
CliFrontend
();
CliFrontend
frontend
=
new
CliFrontend
();
Object
result
=
frontend
.
buildProgram
(
line
);
Object
result
=
frontend
.
buildProgram
(
line
);
assertTrue
(
result
instanceof
PackagedProgram
);
assertTrue
(
result
instanceof
PackagedProgram
);
PackagedProgram
prog
=
(
PackagedProgram
)
result
;
PackagedProgram
prog
=
(
PackagedProgram
)
result
;
Assert
.
assertArrayEquals
(
new
String
[]
{
"
some"
,
"program"
,
"arguments
"
},
prog
.
getArguments
());
Assert
.
assertArrayEquals
(
new
String
[]
{
"
--verbose"
,
"true"
,
"arg1"
,
"arg2
"
},
prog
.
getArguments
());
Assert
.
assertEquals
(
TEST_JAR_MAIN_CLASS
,
prog
.
getMainClassName
());
Assert
.
assertEquals
(
TEST_JAR_MAIN_CLASS
,
prog
.
getMainClassName
());
}
}
catch
(
Exception
e
)
{
catch
(
Exception
e
)
{
...
@@ -110,16 +109,16 @@ public class CliFrontendPackageProgramTest {
...
@@ -110,16 +109,16 @@ public class CliFrontendPackageProgramTest {
@Test
@Test
public
void
testVariantWithExplicitJarAndNoArgumentsOption
()
{
public
void
testVariantWithExplicitJarAndNoArgumentsOption
()
{
try
{
try
{
String
[]
parameters
=
{
"-j"
,
getTestJarPath
(),
"some"
,
"program"
,
"arguments
"
};
String
[]
arguments
=
{
"-j"
,
getTestJarPath
(),
"--verbose"
,
"true"
,
"arg1"
,
"arg2
"
};
CommandLine
line
=
new
PosixParser
().
parse
(
CliFrontend
.
getProgramSpecificOptions
(
new
Options
()),
parameters
,
fals
e
);
CommandLine
line
=
new
PosixParser
().
parse
(
CliFrontend
.
getProgramSpecificOptions
(
new
Options
()),
arguments
,
tru
e
);
CliFrontend
frontend
=
new
CliFrontend
();
CliFrontend
frontend
=
new
CliFrontend
();
Object
result
=
frontend
.
buildProgram
(
line
);
Object
result
=
frontend
.
buildProgram
(
line
);
assertTrue
(
result
instanceof
PackagedProgram
);
assertTrue
(
result
instanceof
PackagedProgram
);
PackagedProgram
prog
=
(
PackagedProgram
)
result
;
PackagedProgram
prog
=
(
PackagedProgram
)
result
;
Assert
.
assertArrayEquals
(
new
String
[]
{
"
some"
,
"program"
,
"arguments
"
},
prog
.
getArguments
());
Assert
.
assertArrayEquals
(
new
String
[]
{
"
--verbose"
,
"true"
,
"arg1"
,
"arg2
"
},
prog
.
getArguments
());
Assert
.
assertEquals
(
TEST_JAR_MAIN_CLASS
,
prog
.
getMainClassName
());
Assert
.
assertEquals
(
TEST_JAR_MAIN_CLASS
,
prog
.
getMainClassName
());
}
}
catch
(
Exception
e
)
{
catch
(
Exception
e
)
{
...
@@ -132,16 +131,16 @@ public class CliFrontendPackageProgramTest {
...
@@ -132,16 +131,16 @@ public class CliFrontendPackageProgramTest {
@Test
@Test
public
void
testValidVariantWithNoJarAndNoArgumentsOption
()
{
public
void
testValidVariantWithNoJarAndNoArgumentsOption
()
{
try
{
try
{
String
[]
parameters
=
{
getTestJarPath
(),
"some"
,
"program"
,
"arguments
"
};
String
[]
arguments
=
{
getTestJarPath
(),
"--verbose"
,
"true"
,
"arg1"
,
"arg2
"
};
CommandLine
line
=
new
PosixParser
().
parse
(
CliFrontend
.
getProgramSpecificOptions
(
new
Options
()),
parameters
,
fals
e
);
CommandLine
line
=
new
PosixParser
().
parse
(
CliFrontend
.
getProgramSpecificOptions
(
new
Options
()),
arguments
,
tru
e
);
CliFrontend
frontend
=
new
CliFrontend
();
CliFrontend
frontend
=
new
CliFrontend
();
Object
result
=
frontend
.
buildProgram
(
line
);
Object
result
=
frontend
.
buildProgram
(
line
);
assertTrue
(
result
instanceof
PackagedProgram
);
assertTrue
(
result
instanceof
PackagedProgram
);
PackagedProgram
prog
=
(
PackagedProgram
)
result
;
PackagedProgram
prog
=
(
PackagedProgram
)
result
;
Assert
.
assertArrayEquals
(
new
String
[]
{
"
some"
,
"program"
,
"arguments
"
},
prog
.
getArguments
());
Assert
.
assertArrayEquals
(
new
String
[]
{
"
--verbose"
,
"true"
,
"arg1"
,
"arg2
"
},
prog
.
getArguments
());
Assert
.
assertEquals
(
TEST_JAR_MAIN_CLASS
,
prog
.
getMainClassName
());
Assert
.
assertEquals
(
TEST_JAR_MAIN_CLASS
,
prog
.
getMainClassName
());
}
}
catch
(
Exception
e
)
{
catch
(
Exception
e
)
{
...
@@ -154,8 +153,8 @@ public class CliFrontendPackageProgramTest {
...
@@ -154,8 +153,8 @@ public class CliFrontendPackageProgramTest {
@Test
@Test
public
void
testNoJarNoArgumentsAtAll
()
{
public
void
testNoJarNoArgumentsAtAll
()
{
try
{
try
{
String
[]
parameter
s
=
{};
String
[]
argument
s
=
{};
CommandLine
line
=
new
PosixParser
().
parse
(
CliFrontend
.
getProgramSpecificOptions
(
new
Options
()),
parameters
,
fals
e
);
CommandLine
line
=
new
PosixParser
().
parse
(
CliFrontend
.
getProgramSpecificOptions
(
new
Options
()),
arguments
,
tru
e
);
CliFrontend
frontend
=
new
CliFrontend
();
CliFrontend
frontend
=
new
CliFrontend
();
Object
result
=
frontend
.
buildProgram
(
line
);
Object
result
=
frontend
.
buildProgram
(
line
);
...
@@ -171,8 +170,8 @@ public class CliFrontendPackageProgramTest {
...
@@ -171,8 +170,8 @@ public class CliFrontendPackageProgramTest {
@Test
@Test
public
void
testNonExistingFileWithArguments
()
{
public
void
testNonExistingFileWithArguments
()
{
try
{
try
{
String
[]
parameters
=
{
"/some/none/existing/path"
,
"some"
,
"program"
,
"arguments
"
};
String
[]
arguments
=
{
"/some/none/existing/path"
,
"--verbose"
,
"true"
,
"arg1"
,
"arg2
"
};
CommandLine
line
=
new
PosixParser
().
parse
(
CliFrontend
.
getProgramSpecificOptions
(
new
Options
()),
parameters
,
fals
e
);
CommandLine
line
=
new
PosixParser
().
parse
(
CliFrontend
.
getProgramSpecificOptions
(
new
Options
()),
arguments
,
tru
e
);
CliFrontend
frontend
=
new
CliFrontend
();
CliFrontend
frontend
=
new
CliFrontend
();
Object
result
=
frontend
.
buildProgram
(
line
);
Object
result
=
frontend
.
buildProgram
(
line
);
...
@@ -188,8 +187,8 @@ public class CliFrontendPackageProgramTest {
...
@@ -188,8 +187,8 @@ public class CliFrontendPackageProgramTest {
@Test
@Test
public
void
testNonExistingFileWithoutArguments
()
{
public
void
testNonExistingFileWithoutArguments
()
{
try
{
try
{
String
[]
parameter
s
=
{
"/some/none/existing/path"
};
String
[]
argument
s
=
{
"/some/none/existing/path"
};
CommandLine
line
=
new
PosixParser
().
parse
(
CliFrontend
.
getProgramSpecificOptions
(
new
Options
()),
parameters
,
fals
e
);
CommandLine
line
=
new
PosixParser
().
parse
(
CliFrontend
.
getProgramSpecificOptions
(
new
Options
()),
arguments
,
tru
e
);
CliFrontend
frontend
=
new
CliFrontend
();
CliFrontend
frontend
=
new
CliFrontend
();
Object
result
=
frontend
.
buildProgram
(
line
);
Object
result
=
frontend
.
buildProgram
(
line
);
...
@@ -204,43 +203,48 @@ public class CliFrontendPackageProgramTest {
...
@@ -204,43 +203,48 @@ public class CliFrontendPackageProgramTest {
/**
/**
* Ensure that we will never have the following error.
* Ensure that we will never have the following error.
*
*
* The test works as follows:
* <pre>
* - Use the CliFrontend to invoke a jar file that loads a class which is only available
* in the jarfile itself (via a custom classloader)
* - Change the Usercode classloader of the PackagedProgram to a special classloader for this test
* - the classloader will accept the special class (and return a String.class)
*
* org.apache.flink.client.program.ProgramInvocationException: The main method caused an error.
* org.apache.flink.client.program.ProgramInvocationException: The main method caused an error.
at org.apache.flink.client.program.PackagedProgram.callMainMethod(PackagedProgram.java:398)
* at org.apache.flink.client.program.PackagedProgram.callMainMethod(PackagedProgram.java:398)
at org.apache.flink.client.program.PackagedProgram.invokeInteractiveModeForExecution(PackagedProgram.java:301)
* at org.apache.flink.client.program.PackagedProgram.invokeInteractiveModeForExecution(PackagedProgram.java:301)
at org.apache.flink.client.program.Client.getOptimizedPlan(Client.java:140)
* at org.apache.flink.client.program.Client.getOptimizedPlan(Client.java:140)
at org.apache.flink.client.program.Client.getOptimizedPlanAsJson(Client.java:125)
* at org.apache.flink.client.program.Client.getOptimizedPlanAsJson(Client.java:125)
at org.apache.flink.client.CliFrontend.info(CliFrontend.java:439)
* at org.apache.flink.client.CliFrontend.info(CliFrontend.java:439)
at org.apache.flink.client.CliFrontend.parseParameters(CliFrontend.java:931)
* at org.apache.flink.client.CliFrontend.parseParameters(CliFrontend.java:931)
at org.apache.flink.client.CliFrontend.main(CliFrontend.java:951)
* at org.apache.flink.client.CliFrontend.main(CliFrontend.java:951)
Caused by: java.io.IOException: java.lang.RuntimeException: java.lang.ClassNotFoundException: org.apache.hadoop.hive.ql.io.RCFileInputFormat
* Caused by: java.io.IOException: java.lang.RuntimeException: java.lang.ClassNotFoundException: org.apache.hadoop.hive.ql.io.RCFileInputFormat
at org.apache.hcatalog.mapreduce.HCatInputFormat.setInput(HCatInputFormat.java:102)
* at org.apache.hcatalog.mapreduce.HCatInputFormat.setInput(HCatInputFormat.java:102)
at org.apache.hcatalog.mapreduce.HCatInputFormat.setInput(HCatInputFormat.java:54)
* at org.apache.hcatalog.mapreduce.HCatInputFormat.setInput(HCatInputFormat.java:54)
at tlabs.CDR_In_Report.createHCatInputFormat(CDR_In_Report.java:322)
* at tlabs.CDR_In_Report.createHCatInputFormat(CDR_In_Report.java:322)
at tlabs.CDR_Out_Report.main(CDR_Out_Report.java:380)
* at tlabs.CDR_Out_Report.main(CDR_Out_Report.java:380)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
* at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
* at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
* at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:622)
* at java.lang.reflect.Method.invoke(Method.java:622)
at org.apache.flink.client.program.PackagedProgram.callMainMethod(PackagedProgram.java:383)
* at org.apache.flink.client.program.PackagedProgram.callMainMethod(PackagedProgram.java:383)
* </pre>
*
* The test works as follows:
*
* <ul>
* <li> Use the CliFrontend to invoke a jar file that loads a class which is only available
* in the jarfile itself (via a custom classloader)
* <li> Change the Usercode classloader of the PackagedProgram to a special classloader for this test
* <li> the classloader will accept the special class (and return a String.class)
* </ul>
*/
*/
@Test
@Test
public
void
testPlanWithExternalClass
()
throws
CompilerException
,
ProgramInvocationException
{
public
void
testPlanWithExternalClass
()
throws
CompilerException
,
ProgramInvocationException
{
final
boolean
[]
callme
=
{
false
};
// create a final object reference, to be able to change its val later
final
boolean
[]
callme
=
{
false
};
// create a final object reference, to be able to change its val later
try
{
try
{
String
[]
parameters
=
{
getTestJarPath
(),
"-c"
,
TEST_JAR_CLASSLOADERTEST_CLASS
,
"some"
,
"program
"
};
String
[]
arguments
=
{
"-j"
,
getTestJarPath
(),
"-c"
,
TEST_JAR_CLASSLOADERTEST_CLASS
,
"--verbose"
,
"true"
,
"arg1"
,
"arg2
"
};
CommandLine
line
=
new
PosixParser
().
parse
(
CliFrontend
.
getProgramSpecificOptions
(
new
Options
()),
parameters
,
fals
e
);
CommandLine
line
=
new
PosixParser
().
parse
(
CliFrontend
.
getProgramSpecificOptions
(
new
Options
()),
arguments
,
tru
e
);
CliFrontend
frontend
=
new
CliFrontend
();
CliFrontend
frontend
=
new
CliFrontend
();
Object
result
=
frontend
.
buildProgram
(
line
);
Object
result
=
frontend
.
buildProgram
(
line
);
assertTrue
(
result
instanceof
PackagedProgram
);
assertTrue
(
result
instanceof
PackagedProgram
);
PackagedProgram
prog
=
spy
((
PackagedProgram
)
result
);
PackagedProgram
prog
=
spy
((
PackagedProgram
)
result
);
ClassLoader
testClassLoader
=
new
ClassLoader
(
prog
.
getUserCodeClassLoader
())
{
ClassLoader
testClassLoader
=
new
ClassLoader
(
prog
.
getUserCodeClassLoader
())
{
...
@@ -256,7 +260,7 @@ public class CliFrontendPackageProgramTest {
...
@@ -256,7 +260,7 @@ public class CliFrontendPackageProgramTest {
};
};
when
(
prog
.
getUserCodeClassLoader
()).
thenReturn
(
testClassLoader
);
when
(
prog
.
getUserCodeClassLoader
()).
thenReturn
(
testClassLoader
);
Assert
.
assertArrayEquals
(
new
String
[]{
"
some"
,
"program
"
},
prog
.
getArguments
());
Assert
.
assertArrayEquals
(
new
String
[]{
"
--verbose"
,
"true"
,
"arg1"
,
"arg2
"
},
prog
.
getArguments
());
Assert
.
assertEquals
(
TEST_JAR_CLASSLOADERTEST_CLASS
,
prog
.
getMainClassName
());
Assert
.
assertEquals
(
TEST_JAR_CLASSLOADERTEST_CLASS
,
prog
.
getMainClassName
());
Configuration
c
=
new
Configuration
();
Configuration
c
=
new
Configuration
();
...
@@ -275,9 +279,9 @@ public class CliFrontendPackageProgramTest {
...
@@ -275,9 +279,9 @@ public class CliFrontendPackageProgramTest {
}
}
}
}
catch
(
Exception
e
)
{
catch
(
Exception
e
)
{
assertTrue
(
"Classloader was not called"
,
callme
[
0
]);
System
.
err
.
println
(
e
.
getMessage
());
System
.
err
.
println
(
e
.
getMessage
());
e
.
printStackTrace
();
e
.
printStackTrace
();
assertTrue
(
"Classloader was not called"
,
callme
[
0
]);
fail
(
"Program caused an exception: "
+
e
.
getMessage
());
fail
(
"Program caused an exception: "
+
e
.
getMessage
());
}
}
...
...
flink-clients/src/test/java/org/apache/flink/client/testjar/WordCount.java
浏览文件 @
93eadca7
...
@@ -98,6 +98,7 @@ public class WordCount {
...
@@ -98,6 +98,7 @@ public class WordCount {
// *************************************************************************
// *************************************************************************
private
static
boolean
fileOutput
=
false
;
private
static
boolean
fileOutput
=
false
;
private
static
boolean
verbose
=
false
;
private
static
String
textPath
;
private
static
String
textPath
;
private
static
String
outputPath
;
private
static
String
outputPath
;
...
@@ -106,9 +107,13 @@ public class WordCount {
...
@@ -106,9 +107,13 @@ public class WordCount {
if
(
args
.
length
>
0
)
{
if
(
args
.
length
>
0
)
{
// parse input arguments
// parse input arguments
fileOutput
=
true
;
fileOutput
=
true
;
if
(
args
.
length
==
2
)
{
if
(
args
.
length
==
2
)
{
// cli line: program {textPath} {outputPath}
textPath
=
args
[
0
];
textPath
=
args
[
0
];
outputPath
=
args
[
1
];
outputPath
=
args
[
1
];
}
else
if
(
args
.
length
==
4
&&
(
args
[
0
].
startsWith
(
"-v"
)
||
args
[
0
].
startsWith
(
"--verbose"
)))
{
// cli line: program {optArg} {optVal} {textPath} {outputPath}
verbose
=
Boolean
.
valueOf
(
args
[
1
]);
textPath
=
args
[
2
];
outputPath
=
args
[
3
];
}
else
{
}
else
{
System
.
err
.
println
(
"Usage: WordCount <text path> <result path>"
);
System
.
err
.
println
(
"Usage: WordCount <text path> <result path>"
);
return
false
;
return
false
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录