Skip to content

Commit

Permalink
fix: change --file to --config
Browse files Browse the repository at this point in the history
It is more self-describable.
  • Loading branch information
azzamsa committed Dec 21, 2022
1 parent f069b3e commit 4969414
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ pub struct Opts {
pub rtype: RecordType,

/// Specify an alternate configuration file
#[arg(short = 'f', long = "file", default_value_os_t = PathBuf::from("digs.toml"))]
#[arg(short, long, default_value_os_t = PathBuf::from("digs.toml"))]
pub config: PathBuf,
}

Expand Down
16 changes: 8 additions & 8 deletions tests/integration_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ fn help() -> Result<(), Box<dyn Error>> {
fn default_config_not_found() -> Result<(), Box<dyn Error>> {
let mut cmd = Command::cargo_bin("digs")?;
cmd.arg("example.net")
.arg("-f")
.arg("-c")
.arg("file/doesnt/exist/digs.toml");
cmd.assert()
.failure()
Expand All @@ -27,7 +27,7 @@ fn default_config_not_found() -> Result<(), Box<dyn Error>> {
#[test]
fn config_not_found() -> Result<(), Box<dyn Error>> {
let mut cmd = Command::cargo_bin("digs")?;
cmd.arg("example.net").arg("-f").arg("file/doesnt/exist");
cmd.arg("example.net").arg("-c").arg("file/doesnt/exist");
cmd.assert()
.failure()
.stderr(predicate::str::contains("Configuration file is not found"));
Expand All @@ -38,7 +38,7 @@ fn config_not_found() -> Result<(), Box<dyn Error>> {
fn config_invalid() -> Result<(), Box<dyn Error>> {
let mut cmd = Command::cargo_bin("digs")?;
cmd.arg("example.net")
.arg("-f")
.arg("-c")
.arg("tests/fixture/invalid.toml");
cmd.assert().failure().stderr(predicate::str::contains(
"Invalid configuration: missing field `name`",
Expand All @@ -51,7 +51,7 @@ fn rtype_invalid() -> Result<(), Box<dyn Error>> {
let mut cmd = Command::cargo_bin("digs")?;
cmd.arg("example.net")
.arg("FOO")
.arg("-f")
.arg("-c")
.arg("tests/fixture/digs.toml");
cmd.assert().failure().stderr(predicate::str::contains(
r#"'FOO' isn't a valid value for '[RTYPE]'"#,
Expand All @@ -65,7 +65,7 @@ fn rtype_too_many() -> Result<(), Box<dyn Error>> {
cmd.arg("example.net")
.arg("A")
.arg("MX")
.arg("-f")
.arg("-c")
.arg("tests/fixture/digs.toml");
cmd.assert().failure().stderr(predicate::str::contains(
"Found argument 'MX' which wasn't expected",
Expand All @@ -77,7 +77,7 @@ fn rtype_too_many() -> Result<(), Box<dyn Error>> {
fn address_invalid() -> Result<(), Box<dyn Error>> {
let mut cmd = Command::cargo_bin("digs")?;
cmd.arg("example.net")
.arg("-f")
.arg("-c")
.arg("tests/fixture/invalid-address.toml");
cmd.assert()
.success()
Expand All @@ -100,7 +100,7 @@ fn query() -> Result<(), Box<dyn Error>> {
let mut cmd = Command::cargo_bin("digs")?;
cmd.arg("example.net")
.arg("A")
.arg("-f")
.arg("-c")
.arg("tests/fixture/digs.toml");
cmd.assert()
.success()
Expand All @@ -113,7 +113,7 @@ fn query() -> Result<(), Box<dyn Error>> {
fn query_without_rtype() -> Result<(), Box<dyn Error>> {
let mut cmd = Command::cargo_bin("digs")?;
cmd.arg("example.net")
.arg("-f")
.arg("-c")
.arg("tests/fixture/digs.toml");
cmd.assert()
.success()
Expand Down

0 comments on commit 4969414

Please sign in to comment.