Skip to content

feat: default option for depth from config file#315

Merged
bootandy merged 2 commits into
bootandy:masterfrom
yitsushi:default-depth
Mar 6, 2023
Merged

feat: default option for depth from config file#315
bootandy merged 2 commits into
bootandy:masterfrom
yitsushi:default-depth

Conversation

@yitsushi

@yitsushi yitsushi commented Feb 28, 2023

Copy link
Copy Markdown
Contributor
  • If --depth flag is not defined (or it has an invalid value), a value from the config file will be used.
  • If no depth entry in the config file (or there is no config file), the default usize::MAX will be used.

Added test cases:

  • no config and no flag defined -> usize::MAX should be used
  • config defined, but flag is not defined -> config value should be used
  • config is not defined, but flag is defined -> flag value should be used
  • both config and flag is defined -> flag value should be used

Additional changes:

  • Fixed some clippy issues.
  • Added comments to the example config.toml file. (copy from flag description)

Closes #314

- If `--depth` flag is not defined (or it has an invalid value), a value
  from the config file will be used.
- If no `depth` entry in the config file (or there is no config file),
  the default `usize::MAX` will be used.

Added test cases:
- no config and no flag defined              -> `usize::MAX` should be used
- config defined, but flag is not defined    -> config value should be used
- config is not defined, but flag is defined -> flag value should be used
- both config and flag is defined            -> flag value should be used

Additional changes:

- Fixed some clippy issues.
- Added comments to the example `config.toml` file.
  (copy from flag description)

Closes: bootandy#314

Signed-off-by: Balazs Nadasdi <efertone@pm.me>
Comment thread src/display.rs
};
DisplayData {
initial: initial,
initial,

@yitsushi yitsushi Feb 28, 2023

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixes clippy warning:

warning: redundant field names in struct initialization

help: replace it with: `initial`

Comment thread tests/test_flags.rs

// Verify no 'symbols' reported by screen reader
assert!(!output.contains("│"));
assert!(!output.contains('│'));

@yitsushi yitsushi Feb 28, 2023

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixes clippy warning:

warning: single-character string constant used as pattern

help: try using a `char` instead: `'│'`

Comment thread config/config.toml Outdated
iso=true

# Depth to show
depth=1

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I might remove this from the default config later - but you will be able to add it back in to your local config if you want it.

@yitsushi yitsushi Mar 5, 2023

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh that's the default config? I thought it's just an example with a few options. Then I can remove it.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed it from this file.

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

actually this was my bad it was examples - sorry.

Signed-off-by: Efertone <efertone@pm.me>
@bootandy bootandy merged commit e17a1af into bootandy:master Mar 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Default depth value from config

2 participants