Skip to content

C API: CLI integration (tracking) #10436

Open
@roberth

Description

Is your feature request related to a problem? Please describe.

For a close-to-native UX, it'd be good to support many of the CLI features in other languages.

This could take many forms:

  • Functions that return the set of flag strings, as well as their arity (number of subsequent arguments consumed). These can be passed automatically to argument parsing libraries. These functions should ideally not depend on any nix_lib*_init functions.
  • Functions that expose the CLI classes somehow. This would achieve the most Nix-like UX details. This won't be suitable for applications that aren't primarily Nix-focused.
  • Functions that expose the configuration system.
  • Functions that expose the logging system and progress bar.

Describe the solution you'd like

Consider the above, but perhaps only after we've made some progress on the settings system.

Describe alternatives you've considered

  • A function that parses command line flags while ignoring anything that's not recognized by Nix. I don't like such functions, because it assumes that - does not occur in non-flag positions in the host CLI. While this often holds up, it inevitably won't, e.g. --skopeo-flags --remove-signatures. What if Nix also accepts, or worse starts to accept --remove-signatures? It'd filter out --remove-signatures, and whatever argument follows will be passed to skopeo.

Additional context

Priorities

Add 👍 to issues you find important.

Metadata

Assignees

No one assigned

    Labels

    c apiNix as a C library with a stable interfacefeatureFeature request or proposalsettingsSettings, global flags, nix.conf

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions