Skip to content

Commit

Permalink
Docs/improve documentation for cli options. (#763)
Browse files Browse the repository at this point in the history
Co-authored-by: mgiagante <[email protected]>
  • Loading branch information
mgiagante and mgiagante authored Jan 13, 2025
1 parent fc7c42a commit 4d1854d
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 13 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -126,11 +126,11 @@ Usage: `aderyn [OPTIONS] <ROOT>`
`<ROOT>`: The path to the root of the codebase to be analyzed. Defaults to the current directory.

Options:
- `-s`, `--src`: Path to the source contracts. If not provided, or if aderyn can't find famous files to read (like `foundry.toml`, which it automatically searches for) the ROOT directory will be used.
- `-s`, `--src`: Path to the source contracts. Used to avoid analyzing libraries, tests or scripts and focus on the contracts. If not provided, or if aderyn can't find famous files to read (like `foundry.toml`, which it automatically searches for) the ROOT directory will be used.
- In foundry projects, this is usually the `src/` folder unless stated otherwise in `foundry.toml`.
- In Hardhat projects, this is usually the `contracts/` folder unless stated otherwise in the config.
- `-i`, `--path-includes <PATH_INCLUDES>`: List of path strings to include, delimited by comma (no spaces). Any solidity file path not containing these strings will be ignored
- `-x`, `--path-excludes <PATH_EXCLUDES>`: List of path strings to exclude, delimited by comma (no spaces). Any solidity file path containing these strings will be ignored
- `-i`, `--path-includes <PATH_INCLUDES>`: List of path strings to include, delimited by comma (no spaces). It allows to include only one or more specific contracts in the analysis. Any solidity file path not containing these strings will be ignored.
- `-x`, `--path-excludes <PATH_EXCLUDES>`: List of path strings to exclude, delimited by comma (no spaces). It allows to exclude one or more specific contracts from the analysis. Any solidity file path containing these strings will be ignored
- `-o`, `--output <OUTPUT>`: Desired file path for the final report (will overwrite the existing one) [default: report.md]
- `-n`, `--no-snippets`: Do not include code snippets in the report (reduces report size in large repos)
- `-h`, `--help`: Print help
Expand Down
6 changes: 3 additions & 3 deletions aderyn/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -132,11 +132,11 @@ Usage: `aderyn [OPTIONS] <ROOT>`
`<ROOT>`: The path to the root of the codebase to be analyzed. Defaults to the current directory.

Options:
- `-s`, `--src`: Path to the source contracts. If not provided, or if aderyn can't find famous files to read (like `foundry.toml`, which it automatically searches for) the ROOT directory will be used.
- `-s`, `--src`: Path to the source contracts. Used to avoid analyzing libraries, tests or scripts and focus on the contracts. If not provided, or if aderyn can't find famous files to read (like `foundry.toml`, which it automatically searches for) the ROOT directory will be used.
- In foundry projects, this is usually the `src/` folder unless stated otherwise in `foundry.toml`.
- In Hardhat projects, this is usually the `contracts/` folder unless stated otherwise in the config.
- `-i`, `--path-includes <PATH_INCLUDES>`: List of path strings to include, delimited by comma (no spaces). Any solidity file path not containing these strings will be ignored
- `-x`, `--path-excludes <PATH_EXCLUDES>`: List of path strings to exclude, delimited by comma (no spaces). Any solidity file path containing these strings will be ignored
- `-i`, `--path-includes <PATH_INCLUDES>`: List of path strings to include, delimited by comma (no spaces). It allows to include only one or more specific contracts in the analysis. Any solidity file path not containing these strings will be ignored.
- `-x`, `--path-excludes <PATH_EXCLUDES>`: List of path strings to exclude, delimited by comma (no spaces). It allows to exclude one or more specific contracts from the analysis. Any solidity file path containing these strings will be ignored
- `-o`, `--output <OUTPUT>`: Desired file path for the final report (will overwrite the existing one) [default: report.md]
- `-n`, `--no-snippets`: Do not include code snippets in the report (reduces report size in large repos)
- `-h`, `--help`: Print help
Expand Down
20 changes: 13 additions & 7 deletions aderyn/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,25 +19,31 @@ pub struct CommandLineArgs {
#[arg(default_value = ".")]
root: String,

/// Path to the source contracts. If not provided, the ROOT directory will be used.
/// Path to the source contracts.
/// Used to avoid analyzing libraries, tests or scripts and focus on the contracts.
///
/// For example, in a foundry repo:
/// In Foundry projects, it's auto-captured by foundry.toml and it's usually
/// not necessary to provide it.
///
/// --src=src/
///
/// In a hardhat repo:
/// In a Hardhat project:
///
/// --src=contracts/
#[clap(short, long, use_value_delimiter = true)]
src: Option<Vec<String>>,

/// List of path strings to include, delimited by comma (no spaces).
/// Any solidity file path not containing these strings will be ignored
///
/// It allows to include only one or more specific contracts in the analysis:
/// aderyn -i src/MyContract.sol
/// aderyn -i src/MyContract.sol,src/MyOtherContract.sol
#[clap(short = 'i', long, use_value_delimiter = true)]
path_includes: Option<Vec<String>>,

/// List of path strings to exclude, delimited by comma (no spaces).
/// Any solidity file path containing these strings will be ignored
///
/// It allows to exclude one or more specific contracts from the analysis:
/// aderyn -x src/MyContract.sol
/// aderyn -x src/MyContract.sol,src/MyOtherContract.sol
#[clap(short = 'x', long, use_value_delimiter = true)]
path_excludes: Option<Vec<String>>,

Expand Down

0 comments on commit 4d1854d

Please sign in to comment.