tty: true
image: onap/cli
environment:
- CLI_DEV: "true"
CLI_MODE: 'console'
ONAP_CLI_DEBUG: "true"
expose:
private boolean isInteractiveMode = false;
- private boolean isDevMode = Boolean.parseBoolean(System.getenv(Constants.CLI_DEV_MODE));
-
private OnapCommandParameterCache paramCache = OnapCommandParameterCache.getInstance();
public boolean isInteractiveMode() {
paramCache.remove(this.getEnabledProductVersion(), paramName);
}
- public boolean isDevMode() {
- return isDevMode;
- }
-
- public void setDevMode(boolean isDevMode) {
- this.isDevMode = isDevMode;
- }
-
public void setProfile(String profileName) {
this.paramCache.setProfile(profileName);
}
public static final String PARAM_CACHE_FILE_NAME = "global-profile";
- public static final String CLI_DEV_MODE = "CLI_DEV";
+ public static final String DISCOVER_ALWAYS = "discover_always";
private Constants() {
}
return false;
}
+ /**
+ * is discovery should do every time.
+ *
+ * @return boolean
+ */
+ public static boolean isDiscoverAlways() {
+ if ("true".equals(prps.getProperty(Constants.DISCOVER_ALWAYS))) {
+ return true;
+ }
+
+ return false;
+ }
+
public static String getVersion() {
return prps.getProperty(Constants.ONAP_CLI_VERSION);
}
*/
public static List<ExternalSchema> loadExternalSchemasFromJson() throws OnapCommandException {
List<ExternalSchema> schemas = new ArrayList<>();
- if (OnapCommandRegistrar.getRegistrar().isDevMode() || !isJsonFileDiscovered()) {
+ if (OnapCommandConfg.isDiscoverAlways() || !isJsonFileDiscovered()) {
schemas = findAllExternalSchemas();
if (!schemas.isEmpty()) {
persist(schemas);
cli.ignore_auth=false
cli.version=1.0
cli.http.api_key_use_cookies=true
-
+cli.discover_always=false
cli.service_name=onap-cli
cli.api_gateway=msb
cli.auth_service=auth
OnapCommandRegistrar.getRegistrar().getParamCache();
OnapCommandRegistrar.getRegistrar().removeParamCache("a");
- OnapCommandRegistrar.getRegistrar().setDevMode(true);
- OnapCommandRegistrar.getRegistrar().isDevMode();
-
OnapCommandRegistrar.getRegistrar().isInteractiveMode();
OnapCommandRegistrar.getRegistrar().setInteractiveMode(false);
import org.onap.cli.main.conf.OnapCliConstants;
import org.onap.cli.main.interactive.StringCompleter;
import org.onap.cli.main.utils.OnapCliUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import jline.TerminalFactory;
import jline.console.ConsoleReader;
*/
public class OnapCli {
+ private static Logger LOG = LoggerFactory.getLogger(OnapCli.class);
+
private List<String> args = new ArrayList<>();
private int exitCode = -1;
}
private void print(Throwable throwable) {
- System.out.println(throwable.getMessage());
- try {
- if (OnapCommandRegistrar.getRegistrar().isDevMode()) {
- throwable.printStackTrace(); // NOSONAR
- }
- } catch (OnapCommandException e) {
- System.out.println(e);
- }
+ this.print(throwable.getMessage());
+ LOG.error(throwable.getMessage(), throwable);
}
private String getShortOption(String opt) {