Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions cedar-policy-cli/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
subcommands, while `-l` refers to `--principal`. Relatedly, the `--policies`
long form of the flag is also now accepted across all subcommands.
- The short form of `--template-linked` was changed from `-t` to `-k`.
- The `format` subcommand no longer takes a positional file argument.

## 2.4.2

Expand Down
10 changes: 5 additions & 5 deletions cedar-policy-cli/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,8 @@ pub struct ValidateArgs {

#[derive(Args, Debug)]
pub struct CheckParseArgs {
/// File containing the policy set
#[clap(short, long = "policies", value_name = "FILE")]
/// Optional policy file name. If none is provided, read input from stdin.
#[arg(short, long = "policies", value_name = "FILE")]
pub policies_file: Option<String>,
}

Expand Down Expand Up @@ -310,8 +310,8 @@ pub struct LinkArgs {
#[derive(Args, Debug)]
pub struct FormatArgs {
/// Optional policy file name. If none is provided, read input from stdin.
#[arg(value_name = "FILE")]
pub file_name: Option<String>,
#[arg(short, long = "policies", value_name = "FILE")]
pub policy_file: Option<String>,

/// Custom line width (default: 80).
#[arg(short, long, value_name = "UINT", default_value_t = 80)]
Expand Down Expand Up @@ -519,7 +519,7 @@ pub fn link(args: &LinkArgs) -> CedarExitCode {
}

fn format_policies_inner(args: &FormatArgs) -> Result<()> {
let policies_str = read_from_file_or_stdin(args.file_name.as_ref(), "policy set")?;
let policies_str = read_from_file_or_stdin(args.policy_file.as_ref(), "policy set")?;
let config = Config {
line_width: args.line_width,
indent_width: args.indent_width,
Expand Down
1 change: 1 addition & 0 deletions cedar-policy-cli/tests/sample.rs
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ fn run_format_test(policies_file: &str) {
let format_cmd = assert_cmd::Command::cargo_bin("cedar")
.expect("bin exists")
.arg("format")
.arg("-p")
.arg(policies_file)
.assert();
assert_eq!(
Expand Down