Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FEATURE request] Command-line interface and language-agnostic configuration language #20

Open
SamuelMarks opened this issue Apr 4, 2024 · 2 comments

Comments

@SamuelMarks
Copy link

SamuelMarks commented Apr 4, 2024

For use in other languages, it would be great to expose a C FFI and (more easily done first) a CLI interface with a language-agnostic configuration language, something like:

# Global to all service-manager-rs
constants: &global_const
   ${if_win}:
      exe: ".exe"
   ${if_not_win}:
      exe: ""

Then you'd roughly have:

name: service_name
constants: &constants
    prefix:
        ${if_win}:
            "%TMP%\foo"
        ${if_not_win}:
            "/tmp/foo"
lifecycle:
   start:  my_init*global_const.exe --prefix *constants.prefix start
   reload: my_init*global_const.exe --prefix *constants.prefix reload
   stop:   my_init*global_const.exe --prefix *constants.prefix stop

Which could be used like so:

$ server-manager install -c "my_yaml_file.yml"
$ server-manager remove "service_name"

And alternatively be specified all at the CLI:

$ server-manager install "my_init" --start "my_init start" --reload "my_init reload" --stop "my_init stop"
$ server-manager remove  "my_init"
@chipsenkbeil
Copy link
Owner

@SamuelMarks I use this library in some of my own CLI tools. Do you see there being much demand for a standalone CLI that offers the functionality you described? Is yaml the popular configuration language to use?

This wouldn't take very long to implement, but thinking of the value here.

@SamuelMarks
Copy link
Author

@chipsenkbeil YAML is pretty popular, as is TOML, JSON and what-have-you. YAML seemed like the simplest syntax to get this example working for you.

I think a CLI would create a whole of new use-cases. For example, I'm working on a large number of new package-managers; originally written in C; then Go; and now Rust (also ² & ³).

(but for outside contributors I wouldn't want to limit their implementation language)

If you think about what is required to build a package manager, it is:

  1. Download
  2. Extract
  3. Dependency resolution (libsolv I guess works here - is open-source and cross-platform [even to Windows])
  4. "Install"
  5. Verification (for download, extract, dependency-resolution, install)

Now the install step might also involve installing services. I haven't seen any other project like yours which does it in such a cross-platform manner.

Kudos!

So what do you think; have I made a sufficient case for being language agnostic and/or creating C bindings? =)

Thanks for your consideration

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants