int run() {
    final Map<String, String> configProps = options.getConfigFile()
        .map(Ksql::loadProperties)
        .orElseGet(Collections::emptyMap);

    final Map<String, String> sessionVariables = options.getVariables();

    try (KsqlRestClient restClient = buildClient(configProps)) {
      try (Cli cli = cliBuilder.build(
          options.getStreamedQueryRowLimit(),
          options.getStreamedQueryTimeoutMs(),
          options.getOutputFormat(),
          restClient)
      ) {
        // Add CLI variables If defined by parameters
        cli.addSessionVariables(sessionVariables);

        if (options.getExecute().isPresent()) {
          return cli.runCommand(options.getExecute().get());
        } else if (options.getScriptFile().isPresent()) {
          final File scriptFile = new File(options.getScriptFile().get());
          if (scriptFile.exists() && scriptFile.isFile()) {
            return cli.runScript(scriptFile.getPath());
          } else {
            throw new KsqlException("No such script file: " + scriptFile.getPath());
          }
        } else {
          return cli.runInteractively();
        }
      }
    }
  }
@Test
  public void shouldRunNonInteractiveCommandWhenExecuteOptionIsUsed() {
    // Given:
    when(options.getExecute()).thenReturn(Optional.of("this is a command"));

    // When:
    ksql.run();

    // Then:
    verify(cli).runCommand("this is a command");
  }