Skip to content

Commit

Permalink
Add CLI crate
Browse files Browse the repository at this point in the history
  • Loading branch information
matei-radu committed Jul 19, 2024
1 parent 8cba14f commit 5cd3d96
Show file tree
Hide file tree
Showing 7 changed files with 74 additions and 3 deletions.
11 changes: 9 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 4 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
[workspace]
members = ["lib"]
members = [
"lib",
"cli"
]
resolver = "2"

[workspace.package]
Expand Down
13 changes: 13 additions & 0 deletions cli/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
[package]
name = "dns_cli"
version = "0.1.0"
description = "A DNS lookup utility"

rust-version.workspace = true
edition.workspace = true
license.workspace = true
authors.workspace = true
repository.workspace = true

[dependencies]
dns_lib = { path = "../lib" }
2 changes: 2 additions & 0 deletions cli/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# DNS CLI
A DNS lookup utility.
21 changes: 21 additions & 0 deletions cli/src/main.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
// Copyright 2024 Matei Bogdan Radu
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

mod version;

use version::fmt_version_info;

fn main() {
println!("{}", fmt_version_info());
}
21 changes: 21 additions & 0 deletions cli/src/version.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
// Copyright 2024 Matei Bogdan Radu
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

use dns_lib::VERSION as LIB_VERSION;

const APP_VERSION: &str = env!("CARGO_PKG_VERSION");

pub fn fmt_version_info() -> String {
format!("dns_cli v{}\ndns_lib v{}\n", APP_VERSION, LIB_VERSION)
}
4 changes: 4 additions & 0 deletions codecov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,7 @@ component_management:
name: dns_lib
paths:
- lib/**
- component_id: dns_cli
name: dns_cli
paths:
- cli/**

0 comments on commit 5cd3d96

Please sign in to comment.