Skip to content

Latest commit

 

History

History
104 lines (74 loc) · 2.73 KB

File metadata and controls

104 lines (74 loc) · 2.73 KB

Developers

← Set up autocompletion

This page is targeted a developers who wish to work on the dsh tool.

Local installation and run

First clone the repository to your local machine:

> git clone git@github.com:kpn-dsh/dsh-cli.git
...
> cd dsh-cli

Then you can for example install the dsh tool on your local machine using:

> cargo install --path .
...
> dsh platform list
...

When developing, it is convenient to set an alias:

> alias dshd="cargo run --all-features --package dsh --bin dsh --"

You can then easily run the dsh tool without installing it:

> dshd platform list
...

Development

Dependencies

The dsh tool has a strong dependency on the dsh_api library that provides the client and data types for the DSH resource management API. This library is published to crates.io and your Cargo.toml file should specify the dependency:

[dependencies]
dsh_api = { version = "0.10.0", features = ["generic"] }

The generic feature must be enabled. The dsh tool has some optional features specified, which correspond to features of the dsh_api crate with the same name:

[features]
manage = ["dsh_api/manage"]
robot = ["dsh_api/robot"]

Because of the strong dependencies between the dsh tool and the library, they are often been worked on at the same time. In that case it is convenient to set the dependency to the local copy of the library crate. Also, you might want to enable the manage feature while developing.

dsh_api = { path = "../dsh-api/dsh-api", features = ["generic", "manage"] }

However, when you publish the dsh tool make sure that you set the dependency back to the crates.io version of the library,

Coding guidelines

Before pushing code to GitHub, make sure that you adhere to the code formatting defined in rustfmt.toml, that you have run the clippy linter and that you did the license check. The following commands should return without any remarks:

> cargo +nightly fmt --check
> cargo clippy
> cargo clippy --all-features
> cargo deny check licenses

Consider configuring your IDE to automatically apply the formatting rules when saving a file.

Unit testing

Be sure to include the --all-features flag when you run the unit tests:

> cargo test --all-features

Integration testing

The tests directory contains some shell scripts that will run a large number of commands in sequence. These are not a full tests, but will catch many bugs which have to do with the command line part of the program. See tests/README.md for more information and a description of the available test scripts.

Publish →