https://github.com/whitequark/opam-query
A tool to query opam files from shell scripts
https://github.com/whitequark/opam-query
Last synced: 4 months ago
JSON representation
A tool to query opam files from shell scripts
- Host: GitHub
- URL: https://github.com/whitequark/opam-query
- Owner: whitequark
- License: mit
- Created: 2014-11-17T15:58:14.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2017-08-22T20:40:17.000Z (almost 8 years ago)
- Last Synced: 2024-05-08T17:09:17.200Z (about 1 year ago)
- Language: OCaml
- Size: 17.6 KB
- Stars: 15
- Watchers: 7
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE.txt
Awesome Lists containing this project
README
opam-query
==========_opam-query_ is a tool that allows querying the OPAM package description
files from shell scripts, similar to `oasis query`.Installation
------------_opam-query_ can be installed via [OPAM](https://opam.ocaml.org):
$ opam install opam-query
Usage
-----_opam-query_ reads the OPAM package description from the provided filename
(`opam` from the current directory by default) and prints the requested fields,
one per line.* `--name`, `--version` and `--dev-repo` print the value of the correponding field.
* `--maintainer`, `--author`, `--homepage`, `--bug-report` and `--license` print
the values of the correponding field, concatenated by,
.
* `--tags` prints the values of the `tags:` field, concatenated by ` `.
* `--name-version` prints the values of `name:` and `version:`, concatenated by `.`.
* `--archive` will attempt to determine a public download URL based on the value
of `dev-repo:` and `version:` fields. Currently, only GitHub is supported.
`--tag-format` allows to customize the tag name; `$(version)` is replaced
by the value of the `verison:` field.Automating package releases
---------------------------_opam-query_ can be used together with [_opam-publish_](https://github.com/AltGr/opam-publish)
to automate the process of releasing OPAM packages. For example, if you have a `Makefile`
and are using GitHub, the following snippet will require nothing more than modifying
the `version:` field and running `make release`.``` make
VERSION := $$(opam query --version)
NAME_VERSION := $$(opam query --name-version)
ARCHIVE := $$(opam query --archive)release:
git tag -a v$(VERSION) -m "Version $(VERSION)."
git push origin v$(VERSION)
opam publish prepare $(NAME_VERSION) $(ARCHIVE)
opam publish submit $(NAME_VERSION)
rm -rf $(NAME_VERSION).PHONY: release
```License
-------_opam-query_ is distributed under the terms of [MIT license](LICENSE.txt).