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

CLI Design Discussion #84

Closed
lunacd opened this issue Jun 15, 2024 · 6 comments
Closed

CLI Design Discussion #84

lunacd opened this issue Jun 15, 2024 · 6 comments

Comments

@lunacd
Copy link
Contributor

lunacd commented Jun 15, 2024

Current State

Currently all options are implemented at the top level, no matter they are from pkgconf, pkg-config or specific to CPS. This could mean a chaotic command line interface as we implement more and more features. This could also lead to a hard situation where we had to break compatibility with pkgconf or pkg-config if we want to add CPS-specific capabilities to ones of the options provided by them.

Proposal

Provide compatibility through subcommands, i.e. cps-config pkgconf should behave in the same way pkgconf behaves, and the same goes for cps-config pkg-config. Everything else outside of those two subcommands are purely CPS-specific territory.

Benefits

  • More freedom in designing an CPS-specific interface. We can design the interface to work in whatever way we please, unburdened by prior design decisions.
  • A clearer and more familiar interface for people using cps-config as a drop-in replacement for pkgconf and pkg-config. We could even aim for a situation where people can alias pkg-config to cps-config pkg-config and expect things to still work.
  • We could even go one step further to make cps-config fall back to the other tools when used in "compatibility mode" but CPS files are not available.
@lunacd
Copy link
Contributor Author

lunacd commented Jun 15, 2024

@dcbaker @tylerjw @bretbrownjr I'm planning to start implementing some actual features but I feel it could be beneficial to have a brief discussion on what kind of interface, on a high level, that we would want to work towards

@bretbrownjr
Copy link
Collaborator

I like this idea!

@dcbaker
Copy link
Collaborator

dcbaker commented Jun 16, 2024

I like this idea too. To go further we might eventually consider doing the argv[0] == "pkg-config" trick so that cps-config` can be installed as pkg-config, though that would mean we'd need to support doing pkg-config lookup as well. If/when we get to that I have some code from an old project we might be able to steal for that purpose.

@tylerjw
Copy link
Contributor

tylerjw commented Jun 17, 2024

I am happy to participate. Let me know how I can help.

@lunacd
Copy link
Contributor Author

lunacd commented Jun 19, 2024

I imagine something like #70 would be crucial to making this happen. Based on that we could also talk about what we consider the first release of cps-config, maybe an interesting level of compatibility with pkg-config for all libraries available on ubuntu?

lunacd added a commit to lunacd/cps-config that referenced this issue Jun 23, 2024
## Main Change

pkg-config compatibility is moved to a subcommand called `cps-config
pkg-config`. As elaborated in cps-org#84, this would make it easier for users
to adopt cps-config by aliasing `pkg-config` to `cps-config pkg-config`.
This also makes it easier for contributors to test compatbility with
pkg-config, and give more freedom in designing cps-specific interfaces.

## Other changes

To make the above change, some additional changes are made:

1. The current top-level options are moved into `cps-config flags`, i.e.
they are for generating linker and compiler flags for a package. My
original intention is to not change the current interface at all, but
CLI11 really don't like global options that are not propagated down to
subcomands. Obviously, some options, like `--modversion`, doesn't sound
like it belongs. And some other options, like `errors-to-stdout`, seems
more appropriate as a global option. Those issues are currently ignored
in this patch because I want to have a minimal set of changes that get
the codebase into a semi-coherent state. We could have more in-depth
discussions on specific interface designs as a separate issues and PR.
But on a really high level, the future interface could look something
like this:

- pkg-config: pkg-config compatibility mode
- pkgconf: pkgconf compatibility mode
- flags: generate flags (but with cps-specific information like
components)
- list: list avaiable packages. This could even support globbing and
this could be used as search as well.
- search: maybe an alias to list
- graph: graph-based operations like the ones pkgconf has but leveraging
cps-specific data
- info: print info for a package, like version, etc.
- anything else we want

2. The current integration test suite is named as "pkg-config
compatibility" but has since drifted away to include cps-specific
behavior like components. The current test cases are renamed to
`cps-config.toml` and a new `pkg-config-compat.toml` is created to test
compatibility with pkg-config.

3. Currently, the example cps files are housed in `tests/cases`. The
directory name seems more appropriate for test cases encoded in toml
files. The example cps files are moved to `tests/cps-files`.

## Rationale

See above and cps-org#84.

## Future work

This change would make it much easier to have smoke tests for
compatibility, as mentioned in cps-org#70. We could set up a test harness that
installs all pc files available in ubuntu and transform them into cps
files. Then it could randomly select a combination of supported
pkg-config flags and avaiable libraries to make sure that `pkg-config`
and `cps-config pkg-config` do the same thing. Obviously this would be
too heavy weight to fit in CI and test suites. We should selectively
implement found issues as test cases. Further, this could be used as our
metric of "are we pkg-config compatible yet".
lunacd added a commit to lunacd/cps-config that referenced this issue Jun 26, 2024
## Main Change

pkg-config compatibility is moved to a subcommand called `cps-config
pkg-config`. As elaborated in cps-org#84, this would make it easier for users
to adopt cps-config by aliasing `pkg-config` to `cps-config pkg-config`.
This also makes it easier for contributors to test compatbility with
pkg-config, and give more freedom in designing cps-specific interfaces.

## Other changes

To make the above change, some additional changes are made:

1. The current top-level options are moved into `cps-config flags`, i.e.
they are for generating linker and compiler flags for a package. My
original intention is to not change the current interface at all, but
CLI11 really don't like global options that are not propagated down to
subcomands. Obviously, some options, like `--modversion`, doesn't sound
like it belongs. And some other options, like `errors-to-stdout`, seems
more appropriate as a global option. Those issues are currently ignored
in this patch because I want to have a minimal set of changes that get
the codebase into a semi-coherent state. We could have more in-depth
discussions on specific interface designs as a separate issues and PR.
But on a really high level, the future interface could look something
like this:

- pkg-config: pkg-config compatibility mode
- pkgconf: pkgconf compatibility mode
- flags: generate flags (but with cps-specific information like
components)
- list: list avaiable packages. This could even support globbing and
this could be used as search as well.
- search: maybe an alias to list
- graph: graph-based operations like the ones pkgconf has but leveraging
cps-specific data
- info: print info for a package, like version, etc.
- anything else we want

2. The current integration test suite is named as "pkg-config
compatibility" but has since drifted away to include cps-specific
behavior like components. The current test cases are renamed to
`cps-config.toml` and a new `pkg-config-compat.toml` is created to test
compatibility with pkg-config.

3. Currently, the example cps files are housed in `tests/cases`. The
directory name seems more appropriate for test cases encoded in toml
files. The example cps files are moved to `tests/cps-files`.

## Rationale

See above and cps-org#84.

## Future work

This change would make it much easier to have smoke tests for
compatibility, as mentioned in cps-org#70. We could set up a test harness that
installs all pc files available in ubuntu and transform them into cps
files. Then it could randomly select a combination of supported
pkg-config flags and avaiable libraries to make sure that `pkg-config`
and `cps-config pkg-config` do the same thing. Obviously this would be
too heavy weight to fit in CI and test suites. We should selectively
implement found issues as test cases. Further, this could be used as our
metric of "are we pkg-config compatible yet".
lunacd added a commit to lunacd/cps-config that referenced this issue Jun 26, 2024
## Main Change

pkg-config compatibility is moved to a subcommand called `cps-config
pkg-config`. As elaborated in cps-org#84, this would make it easier for users
to adopt cps-config by aliasing `pkg-config` to `cps-config pkg-config`.
This also makes it easier for contributors to test compatbility with
pkg-config, and give more freedom in designing cps-specific interfaces.

## Other changes

To make the above change, some additional changes are made:

1. The current top-level options are moved into `cps-config flags`, i.e.
they are for generating linker and compiler flags for a package. My
original intention is to not change the current interface at all, but
CLI11 really don't like global options that are not propagated down to
subcomands. Obviously, some options, like `--modversion`, doesn't sound
like it belongs. And some other options, like `errors-to-stdout`, seems
more appropriate as a global option. Those issues are currently ignored
in this patch because I want to have a minimal set of changes that get
the codebase into a semi-coherent state. We could have more in-depth
discussions on specific interface designs as a separate issues and PR.
But on a really high level, the future interface could look something
like this:

- pkg-config: pkg-config compatibility mode
- pkgconf: pkgconf compatibility mode
- flags: generate flags (but with cps-specific information like
components)
- list: list avaiable packages. This could even support globbing and
this could be used as search as well.
- search: maybe an alias to list
- graph: graph-based operations like the ones pkgconf has but leveraging
cps-specific data
- info: print info for a package, like version, etc.
- anything else we want

2. The current integration test suite is named as "pkg-config
compatibility" but has since drifted away to include cps-specific
behavior like components. The current test cases are renamed to
`cps-config.toml` and a new `pkg-config-compat.toml` is created to test
compatibility with pkg-config.

3. Currently, the example cps files are housed in `tests/cases`. The
directory name seems more appropriate for test cases encoded in toml
files. The example cps files are moved to `tests/cps-files`.

## Rationale

See above and cps-org#84.

## Future work

This change would make it much easier to have smoke tests for
compatibility, as mentioned in cps-org#70. We could set up a test harness that
installs all pc files available in ubuntu and transform them into cps
files. Then it could randomly select a combination of supported
pkg-config flags and avaiable libraries to make sure that `pkg-config`
and `cps-config pkg-config` do the same thing. Obviously this would be
too heavy weight to fit in CI and test suites. We should selectively
implement found issues as test cases. Further, this could be used as our
metric of "are we pkg-config compatible yet".
lunacd added a commit to lunacd/cps-config that referenced this issue Jun 26, 2024
## Main Change

pkg-config compatibility is moved to a subcommand called `cps-config
pkg-config`. As elaborated in cps-org#84, this would make it easier for users
to adopt cps-config by aliasing `pkg-config` to `cps-config pkg-config`.
This also makes it easier for contributors to test compatbility with
pkg-config, and give more freedom in designing cps-specific interfaces.

## Other changes

To make the above change, some additional changes are made:

1. The current top-level options are moved into `cps-config flags`, i.e.
they are for generating linker and compiler flags for a package. My
original intention is to not change the current interface at all, but
CLI11 really don't like global options that are not propagated down to
subcomands. Obviously, some options, like `--modversion`, doesn't sound
like it belongs. And some other options, like `errors-to-stdout`, seems
more appropriate as a global option. Those issues are currently ignored
in this patch because I want to have a minimal set of changes that get
the codebase into a semi-coherent state. We could have more in-depth
discussions on specific interface designs as a separate issues and PR.
But on a really high level, the future interface could look something
like this:

- pkg-config: pkg-config compatibility mode
- pkgconf: pkgconf compatibility mode
- flags: generate flags (but with cps-specific information like
components)
- list: list avaiable packages. This could even support globbing and
this could be used as search as well.
- search: maybe an alias to list
- graph: graph-based operations like the ones pkgconf has but leveraging
cps-specific data
- info: print info for a package, like version, etc.
- anything else we want

2. The current integration test suite is named as "pkg-config
compatibility" but has since drifted away to include cps-specific
behavior like components. The current test cases are renamed to
`cps-config.toml` and a new `pkg-config-compat.toml` is created to test
compatibility with pkg-config.

3. Currently, the example cps files are housed in `tests/cases`. The
directory name seems more appropriate for test cases encoded in toml
files. The example cps files are moved to `tests/cps-files`.

## Rationale

See above and cps-org#84.

## Future work

This change would make it much easier to have smoke tests for
compatibility, as mentioned in cps-org#70. We could set up a test harness that
installs all pc files available in ubuntu and transform them into cps
files. Then it could randomly select a combination of supported
pkg-config flags and avaiable libraries to make sure that `pkg-config`
and `cps-config pkg-config` do the same thing. Obviously this would be
too heavy weight to fit in CI and test suites. We should selectively
implement found issues as test cases. Further, this could be used as our
metric of "are we pkg-config compatible yet".
bretbrownjr pushed a commit that referenced this issue Jul 8, 2024
## Main Change

pkg-config compatibility is moved to a subcommand called `cps-config
pkg-config`. As elaborated in #84, this would make it easier for users
to adopt cps-config by aliasing `pkg-config` to `cps-config pkg-config`.
This also makes it easier for contributors to test compatbility with
pkg-config, and give more freedom in designing cps-specific interfaces.

## Other changes

To make the above change, some additional changes are made:

1. The current top-level options are moved into `cps-config flags`, i.e.
they are for generating linker and compiler flags for a package. My
original intention is to not change the current interface at all, but
CLI11 really don't like global options that are not propagated down to
subcomands. Obviously, some options, like `--modversion`, doesn't sound
like it belongs. And some other options, like `errors-to-stdout`, seems
more appropriate as a global option. Those issues are currently ignored
in this patch because I want to have a minimal set of changes that get
the codebase into a semi-coherent state. We could have more in-depth
discussions on specific interface designs as a separate issues and PR.
But on a really high level, the future interface could look something
like this:

- pkg-config: pkg-config compatibility mode
- pkgconf: pkgconf compatibility mode
- flags: generate flags (but with cps-specific information like
components)
- list: list avaiable packages. This could even support globbing and
this could be used as search as well.
- search: maybe an alias to list
- graph: graph-based operations like the ones pkgconf has but leveraging
cps-specific data
- info: print info for a package, like version, etc.
- anything else we want

2. The current integration test suite is named as "pkg-config
compatibility" but has since drifted away to include cps-specific
behavior like components. The current test cases are renamed to
`cps-config.toml` and a new `pkg-config-compat.toml` is created to test
compatibility with pkg-config.

3. Currently, the example cps files are housed in `tests/cases`. The
directory name seems more appropriate for test cases encoded in toml
files. The example cps files are moved to `tests/cps-files`.

## Rationale

See above and #84.

## Future work

This change would make it much easier to have smoke tests for
compatibility, as mentioned in #70. We could set up a test harness that
installs all pc files available in ubuntu and transform them into cps
files. Then it could randomly select a combination of supported
pkg-config flags and avaiable libraries to make sure that `pkg-config`
and `cps-config pkg-config` do the same thing. Obviously this would be
too heavy weight to fit in CI and test suites. We should selectively
implement found issues as test cases. Further, this could be used as our
metric of "are we pkg-config compatible yet".
@lunacd
Copy link
Contributor Author

lunacd commented Sep 30, 2024

Closing as this has already been implemented and merged

@lunacd lunacd closed this as completed Sep 30, 2024
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

4 participants