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

Provides means of querying information about build WAS Offer command to find base directory for package #1087

Closed
bitonic opened this issue Oct 1, 2015 · 7 comments

Comments

@bitonic
Copy link
Contributor

bitonic commented Oct 1, 2015

This command, say package-path, would return the base directory (where the .cabal file lives) for a certain package, e.g.

$ cat stack.yaml
packages:
  - ./foo # Contains foo.cabal, package name foo
  - ./bar # Contains bar.cabal, package name bar
resolver: lts-3
$ stack package-path foo
./foo
@bitonic
Copy link
Contributor Author

bitonic commented Oct 1, 2015

In the same direction, I'd like a

$ stack package-version foo
foo-0.1.2.3

@snoyberg suggested we should have a locals subcommand to do these queries, e.g.

$ stack locals path foo
./foo
$ stack locals version foo
foo-0.1.2.3

@snoyberg
Copy link
Contributor

snoyberg commented Oct 1, 2015

I thought about it a bit more, and I'm thinking we may want to create a much more generic query command, that could include more information in the future. Then perhaps we'd do something like:

$ stack query locals.foo.path
./foo
$ stack query locals.foo.version
0.1.2.3
$ stack query locals.foo
path: ./foo
version: 0.1.2.3

We could also have a different syntax, e.g. stack query locals foo version.

@borsboom borsboom added this to the P2: Should milestone Oct 6, 2015
@borsboom
Copy link
Contributor

borsboom commented Oct 6, 2015

This seems somewhat related to what @drwebb is doing with stack config. At least, it may make sense for aspects of the syntax to be shared.

@snoyberg snoyberg self-assigned this Oct 8, 2015
@snoyberg snoyberg changed the title Offer command to find base directory for package Provides means of querying information about build WAS Offer command to find base directory for package Oct 8, 2015
@snoyberg snoyberg added the ready label Oct 8, 2015
snoyberg added a commit that referenced this issue Oct 8, 2015
snoyberg added a commit that referenced this issue Oct 8, 2015
@snoyberg
Copy link
Contributor

snoyberg commented Oct 8, 2015

@bitonic I've added a new query command to master. With it, your original request can be handled with:

stack query locals foo path

Please give it a shot and let me know if it works.

@bitonic
Copy link
Contributor Author

bitonic commented Oct 29, 2015

Thanks!

@metaleap
Copy link

metaleap commented Apr 2, 2017

Just encountered this. Since searching haskellstack.org for query returns only the change-log pointing to here, a handful of simple questions --- if there has been a posting about this anywhere, do link!

  • is the output of just stack query equivalent to "all possible scopes / queries / selectors with all their possible properties (path/version etc)", or "some select sub-set"?

  • is the output YAML or just some stack-specific-easily-parsed-indented-lines-format?

  • what are the additional (if any) supported scopes (other than locals) and properties (other than path / version)?

  • this is still marked experimental by stack 1.4.0, just an oversight after 1.5 years or any caveats to beware of?

Cheers!

@mgsloan
Copy link
Contributor

mgsloan commented Apr 3, 2017

is the output of just stack query equivalent to "all possible scopes / queries / selectors with all their possible properties (path/version etc)", or "some select sub-set"?

I believe it is all queriable info.

is the output YAML or just some stack-specific-easily-parsed-indented-lines-format?

It's YAML

what are the additional (if any) supported scopes (other than locals) and properties (other than path / version)?

Only supports the structure of the output of plain stack query

this is still marked experimental by stack 1.4.0, just an oversight after 1.5 years or any caveats to beware of?

No caveats, but it doesn't output as much info as a full fledged query feature ought to support.

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

No branches or pull requests

5 participants