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

Unwanted assertion "cannot be set to both the name and the command attributes" #312

Closed
zmrocze opened this issue May 17, 2024 · 0 comments
Closed
Labels
bug Something isn't working

Comments

@zmrocze
Copy link

zmrocze commented May 17, 2024

Hey,

is this assertion really correct or needed?

How to reproduce

Because I have such a case:

devshells.default = {
  devshell = {
    name = "Tidal + haskell shell";
    packagesFrom = [
      config.devShells.haskell
    ];
  };
  commands = [
    {
      category = "Tidal";
      name = "ghci";
      help = "Start ghci";
      command = "ghci";
    }
  ];
};

First this results in error:

       error: [[commands]]: ghci cannot be set to both the `name` and the `command` attributes. Did you mean to use the `package` attribute?

But if I did name = "my-ghci" it would work, because the command ghci is provided by the included packagesFrom = [ config.devShells.haskell ]. So the assertion really bites me.

Alternatives tried

I've tried combinations:

package = "ghci"

doesn't work because package "ghci" not found. I don't have direct access to the package, because I don't have a reference to it, it's included in the haskell shell created by a library function.

Specifying only of command/name fails with either:

       error: [[commands]]: some command is missing both a `name` or `package` attribute.

or

       error: [[commands]]: ghci expected either a command or package attribute.

Finally, naming the command differently works like described above.

Why do I care?

because id like the command to appear in the nice menu.

Summary and realization

OK. I realized the problem. In my case the ghci command would overwrite the ghci command that's already in scope.
Ill close this issue as dumb. Open a new feature request for displaying in menu commands originating from packagesFrom (this ties to issue #311). Refer to here to show how naive solution fails.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant