mirror of
https://github.com/alibaba/arthas.git
synced 2024-04-21 10:21:39 +00:00
as.sh/arthas-boot support width/height options. close #422
This commit is contained in:
@@ -53,6 +53,11 @@ ATTACH_ONLY=false
|
||||
# pass debug arguments to the attach java process
|
||||
DEBUG_ATTACH=false
|
||||
|
||||
# arthas-client terminal height
|
||||
HEIGHT=
|
||||
# arthas-client terminal width
|
||||
WIDTH=
|
||||
|
||||
# Verbose, print debug info.
|
||||
VERBOSE=false
|
||||
|
||||
@@ -410,6 +415,8 @@ Options and Arguments:
|
||||
-c,--command <value> Command to execute, multiple commands separated
|
||||
by ;
|
||||
-f,--batch-file <value> The batch file to execute
|
||||
--height <value> arthas-client terminal height
|
||||
--width <value> arthas-client terminal width
|
||||
-v,--verbose Verbose, print debug info.
|
||||
<pid> Target pid
|
||||
|
||||
@@ -537,6 +544,16 @@ parse_arguments()
|
||||
ARTHAS_OPTS="$JPDA_OPTS $ARTHAS_OPTS"
|
||||
shift # past argument
|
||||
;;
|
||||
--height)
|
||||
HEIGHT="$2"
|
||||
shift # past argument
|
||||
shift # past value
|
||||
;;
|
||||
--width)
|
||||
WIDTH="$2"
|
||||
shift # past argument
|
||||
shift # past value
|
||||
;;
|
||||
-v|--verbose)
|
||||
VERBOSE=true
|
||||
shift # past argument
|
||||
@@ -730,11 +747,22 @@ active_console()
|
||||
fi
|
||||
|
||||
if [ "${BATCH_MODE}" = "true" ]; then
|
||||
local tempArgs=()
|
||||
if [ "${HEIGHT}" ]; then
|
||||
tempArgs+=("--height")
|
||||
tempArgs+=("${HEIGHT}")
|
||||
fi
|
||||
if [ "${WIDTH}" ]; then
|
||||
tempArgs+=("--width")
|
||||
tempArgs+=("${WIDTH}")
|
||||
fi
|
||||
|
||||
if [ "${COMMAND}" ] ; then
|
||||
"${JAVA_HOME}/bin/java" ${ARTHAS_OPTS} ${JVM_OPTS} \
|
||||
-jar "${arthas_lib_dir}/arthas-client.jar" \
|
||||
${TARGET_IP} \
|
||||
${TELNET_PORT} \
|
||||
"${tempArgs[@]}" \
|
||||
-c ${COMMAND}
|
||||
fi
|
||||
if [ "${BATCH_FILE}" ] ; then
|
||||
@@ -742,6 +770,7 @@ active_console()
|
||||
-jar "${arthas_lib_dir}/arthas-client.jar" \
|
||||
${TARGET_IP} \
|
||||
${TELNET_PORT} \
|
||||
"${tempArgs[@]}" \
|
||||
-f ${BATCH_FILE}
|
||||
fi
|
||||
elif type telnet 2>&1 >> /dev/null; then
|
||||
|
||||
@@ -67,6 +67,9 @@ public class Bootstrap {
|
||||
*/
|
||||
private Long sessionTimeout;
|
||||
|
||||
private Integer height = null;
|
||||
private Integer width = null;
|
||||
|
||||
private boolean verbose = false;
|
||||
|
||||
/**
|
||||
@@ -188,6 +191,18 @@ public class Bootstrap {
|
||||
this.batchFile = batchFile;
|
||||
}
|
||||
|
||||
@Option(longName = "height")
|
||||
@Description("arthas-client terminal height")
|
||||
public void setHeight(int height) {
|
||||
this.height = height;
|
||||
}
|
||||
|
||||
@Option(longName = "width")
|
||||
@Description("arthas-client terminal width")
|
||||
public void setWidth(int width) {
|
||||
this.width = width;
|
||||
}
|
||||
|
||||
@Option(shortName = "v", longName = "verbose", flag = true)
|
||||
@Description("Verbose, print debug info.")
|
||||
public void setVerbose(boolean verbose) {
|
||||
@@ -448,6 +463,14 @@ public class Bootstrap {
|
||||
telnetArgs.add("-f");
|
||||
telnetArgs.add(bootstrap.getBatchFile());
|
||||
}
|
||||
if (bootstrap.getHeight() != null) {
|
||||
telnetArgs.add("--height");
|
||||
telnetArgs.add("" + bootstrap.getHeight());
|
||||
}
|
||||
if (bootstrap.getWidth() != null) {
|
||||
telnetArgs.add("--width");
|
||||
telnetArgs.add("" + bootstrap.getWidth());
|
||||
}
|
||||
|
||||
// telnet port ,ip
|
||||
telnetArgs.add(bootstrap.getTargetIp());
|
||||
@@ -581,4 +604,12 @@ public class Bootstrap {
|
||||
public boolean isVersions() {
|
||||
return versions;
|
||||
}
|
||||
|
||||
public Integer getHeight() {
|
||||
return height;
|
||||
}
|
||||
|
||||
public Integer getWidth() {
|
||||
return width;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user