Commit Graph

9 Commits (13d046e6ad8cf16abafd26b9e5b61ea0e3688b19)

Author SHA1 Message Date
Shunsuke Mie 13d046e6ad Move definitions runner related functions
fn runner() and fn from_cli(cli: Cli) util functions are located to
app.rs. However, those are utils for runner. So this commit change the
functions to runner.rs.
3 years ago
Arijit Basu 3f668c2d04 Improve runner API
Some API improvements on top of #324
3 years ago
Tom van Dijk 671d1b11fd Refactored parts of `runner::Runner` to take a Cli struct, instead of putting everything manually in `Runner`. 3 years ago
Arijit Basu 61657a70c7 Add support for loading extra config files
Use `-C` / `--extra-config` to load Lua files to overwrite the default
or user defined config.

This helps with integration, where integrating xplr with another tool
requires xplr to overwrite some config, without requiring the users to
install an xplr plugin or update the xplr config.

Example:

```bash
    xplr -C one.lua two.lua

    # Or

    xplr -C one.lua -C two.lua
```

> **WARNING:**
>
> Extra config doesn't require specifying the `version`, hence, it's the
> integration author or the user's responsibility to assert
> compatibility using the globally exposed `version` in the extra config
> files, similar to xplr plugins.

Ref: https://github.com/sayanarijit/xplr/issues/316
3 years ago
Arijit Basu 6162744bef Minor improvements
Closes: https://github.com/sayanarijit/xplr/issues/305
3 years ago
Arijit Basu 844480204c Support specifying read-only mode via CLI argument
Closes: https://github.com/sayanarijit/xplr/issues/22
3 years ago
Arijit Basu f12e1e5290 Fix config path on macOS
Also, add `-c` / `--config` CLI option to specify custom config file.

Priority is:

`-c <PATH>` > `~/.config/xplr/init.lua` > `/etc/xplr/init.lua`.

Fixes: https://github.com/sayanarijit/xplr/issues/230
3 years ago
Arijit Basu 2962a8d52d Further improve the API.
This improves the compatibility and adds the ability to introduce
non-breaking changes by using a builder pattern.

Example:

```rust
fn main() {
    match xplr::runner(None).and_then(|a| a.run()) {
        Ok(Some(out)) => print!("{}", out),
        Ok(None) => {}
        Err(err) => {
            if !err.to_string().is_empty() {
                eprintln!("error: {}", err);
            };

            std::process::exit(1);
        }
    }
}
```
3 years ago
Arijit Basu fabcc8e865 Implement CLI arguments
Going with custom CLI parsing for minimalism and flexibility.

Closes: https://github.com/sayanarijit/xplr/issues/228
3 years ago