This function issues a command to the SyncroSim console, and is mostly used internally by other functions.

command(args, session = NULL, program = "SyncroSim.Console.exe", wait = TRUE)

Arguments

args

character string, named list, named vector, unnamed list, or unnamed vector. Arguments for the SyncroSim console. See 'details' for more information about this argument

session

Session object. If NULL(default), the default session will be used

program

character. The name of the target SyncroSim executable. Options include "SyncroSim.Console.exe" (default), "SyncroSim.Server.exe", "SyncroSim.PackageManager.exe" and "SyncroSim.Multiband.exe"

wait

logical. If TRUE(default) R will wait for the command to finish before proceeding. Note that silent(session) is ignored if wait=FALSE

Value

Character string: output from the SyncroSim program.

Details

Example args, and the resulting character string passed to the SyncroSim console:

  • Character string e.g. "--create --help": "--create --help"

  • Named list or named vector e.g. list(name1=NULL,name2=value2): "--name1 --name2=value2"

  • Unnamed list or unnamed vector e.g. c("create","help"): "--create --help"

Examples

# \donttest{ # Install "stsim" if not already installed addPackage("stsim")
#> Package <stsim> is already installed
# Set the file path and name of the new SsimLibrary myLibraryName <- file.path(tempdir(),"testlib.ssim") # Specify the command line arguments for creating a new stsim SsimLibrary args <- list(create = NULL, library = NULL, name = myLibraryName, package = "stsim") # Use a default session to create a new SsimLibrary in the current working directory output <- command(args, session = session(printCmd = TRUE))
#> [1] "--version" #> [1] "--create --library --name=C:\\Users\\birch\\AppData\\Local\\Temp\\Rtmp845fE4/testlib.ssim --package=stsim"
output
#> character(0) #> attr(,"status") #> [1] 65535
# Provide arguments to the command line using an unnamed vector command(c("create", "help"))
#> [1] "Creates an item" #> [2] "usage: --create [arguments]" #> [3] "" #> [4] " --library Creates a library." #> [5] " --addon Creates an add-on." #> [6] " --folder Creates a folder." #> [7] " --project Creates a project." #> [8] " --scenario Creates a scenario." #> [9] " --result Creates a result scenario." #> [10] " --dependency Creates a scenario dependency." #> [11] " --help Prints help for an argument."
# Provide arguments to the command line using a character string command("--create --help")
#> [1] "Creates an item" #> [2] "usage: --create [arguments]" #> [3] "" #> [4] " --library Creates a library." #> [5] " --addon Creates an add-on." #> [6] " --folder Creates a folder." #> [7] " --project Creates a project." #> [8] " --scenario Creates a scenario." #> [9] " --result Creates a result scenario." #> [10] " --dependency Creates a scenario dependency." #> [11] " --help Prints help for an argument."
# Provide arguments to the command line using a named list command(list(create = NULL, help = NULL))
#> [1] "Creates an item" #> [2] "usage: --create [arguments]" #> [3] "" #> [4] " --library Creates a library." #> [5] " --addon Creates an add-on." #> [6] " --folder Creates a folder." #> [7] " --project Creates a project." #> [8] " --scenario Creates a scenario." #> [9] " --result Creates a result scenario." #> [10] " --dependency Creates a scenario dependency." #> [11] " --help Prints help for an argument."
# Call on a different program to find all installed packages command(list(installed = NULL), program = "SyncroSim.PackageManager.exe")
#> [1] "burnP3 Burn-P3 package for burn probability modeling 0.0.0 " #> [2] "helloworld Example demonstrating how to create a package 1.0.1 " #> [3] "helloworldConda Example demonstrating how to create a package with Conda environments 1.0.1 " #> [4] "helloworldOmni Example demonstrating how to create a package 1.0.1 " #> [5] "helloworldPipeline Example demonstrating how to use pipelines 1.0.0 " #> [6] "helloworldSpatial Example demonstrating how to use spatial data 1.0.3 " #> [7] "helloworldTime Example demonstrating how to use timesteps 1.0.0 " #> [8] "helloworldUncertainty Example demonstrating how to use iterations 1.0.0 " #> [9] "netlogo Runs the NetLogo agent-based modeling environment 1.2.0 " #> [10] "stconnect Connectivity planning for future climate and land-use change 1.1.16 " #> [11] "stsim The ST-Sim state-and-transition simulation model 3.3.5 " #> [12] "stsimsf Integrates stocks and flows into the ST-Sim simulation model 3.3.4 "
# }