Skip to content
cryi edited this page Jan 20, 2021 · 7 revisions

PUBLIC

am .execute(cliOrCmd, args)
- executes specified command with defined args - cmd defaults to am.__inteface

.execute_extension(path, args?, options)
    - executes file as am extension providing access to all globals, am including
    - options:
        - contextFailExitCode: number 
        - partialErrorMsg: string - partial fallback error message, internal error is added to the end of this msg
        - errorMsg: string - fall back error message, internal error is not included

.get_proc_args()
    - returns all args passed to ami process
    - e.g. for `ami setup --configure` returns `{ "setup", "--configure" }`

.parse_args(cliOrCmd, args, options)
    - parses provided args or args passed to aplication if args not specified
    - relative to cliOrCmd with respect to specified options
    - cmd defaults to am.__inteface

.print_help(cliOrCmd)
    - prints help of specified cliOrCmd
    - cmd defaults to am.__inteface

.use_standard(name)
    - replaces default __interface with base interface of specified standard
    - default = basic
    - app standard is built in, all others will be pulled from remote or local cache

.app
    .load_config()
    .prepare()
    .render()
    .get_version()
    .is_update_available()
    .remove_data()
    .remove()

    .get()                              - gets loaded value from app.h/json
    .get_config(key = nil, default)     - gets value from loaded config or config
    .get_model(key = nil, default)      - gets value from loaded config or config
    .set_model(newModel, path?, options: { merge = false, overwrite = true })
        - sets model or model value

.cache
    .rm_pkgs()      - removes packages from cache
    .rm_plugins()   - removes plugins from cache
    .erase()        - removes everything from cache

.plugin
    .get(id, version) - gets plugin from cache or downloads it

INTERNALS

am .__interface - AMI reference .__parse_base_args() - parses default args .__reload_interface() - updates AMI reference (above) from ami.lua

.app
    .__is_loaded()  - returns true if app config was loaded

TEST_MODE:

am .app .__get() - returns internal __APP .__set() - sets internal __APP

.plugin
    .__remove_cached(id, version) - removes all plugins from cache

TODO: consider possibility to drop dependency on posix/win32 fs api

Clone this wiki locally