Skip to content

Commit

Permalink
Test
Browse files Browse the repository at this point in the history
  • Loading branch information
placintaalexandru committed Dec 28, 2023
1 parent 2c6b410 commit 4083975
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 41 deletions.
6 changes: 3 additions & 3 deletions dist/index.js

Large diffs are not rendered by default.

30 changes: 0 additions & 30 deletions package-lock.json

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

1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@
"@actions/exec": "^1.0.4",
"@actions/io": "^1.0.2",
"@actions/cache": "3.2.2",
"action-input-parser": "1.2.38",
"string-argv": "^0.3.1",
"commander": "11.1.0",
"semver": "^7.5.4"
Expand Down
10 changes: 5 additions & 5 deletions src/command.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { Command, Option } from "commander";
import * as parser from "action-input-parser";
import * as inputUtils from "./utils/input";
import { RawInput } from "./types";
import { Cargo } from "./cargo";
Expand All @@ -9,17 +8,18 @@ import * as annotate from "./annotate";
export const clippyCommand = (): Command => {
return new Command()
.addOption(
new Option("--args [args]", "Arguments for clippy")
new Option("--args [args...]", "Arguments for clippy")
.argParser(inputUtils.collect)
.default(

Check failure on line 13 in src/command.ts

View workflow job for this annotation

GitHub Actions / Lint check

Replace `⏎····················process.env["INPUT_ARGS"]?.split("·")·||·[],` with `process.env["INPUT_ARGS"]?.split("·")·||·[])`
parser.getInput("args", { type: "array", default: [] }),
),
process.env["INPUT_ARGS"]?.split(" ") || [],
).makeOptionMandatory(false),

Check failure on line 15 in src/command.ts

View workflow job for this annotation

GitHub Actions / Lint check

Delete `)`
)
.action(async (options: RawInput) => {
// `--message-format=json` should just right after the `cargo clippy`
// because usually people are adding the `-- -D warnings` at the end
// of arguments, and it will mess up the output.
core.info(JSON.stringify(options.args));
console.log(JSON.stringify(options.args));

const args = ["clippy", "--message-format=json"].concat(
options.args,
);
Expand Down
8 changes: 6 additions & 2 deletions src/utils/input.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
export const collect = (value: string): string[] => {
return value.split(" ");
export const collect = (value: string, previous: string[]): string[] => {
if (!previous) {
return [value];
}

return previous.concat([value]);
};

0 comments on commit 4083975

Please sign in to comment.