mirror of
				https://github.com/threeal/cmake-action.git
				synced 2025-11-04 05:43:42 +00:00 
			
		
		
		
	feat: parse quotation in args input
				
					
				
			Signed-off-by: Alfi Maulana <alfi.maulana.f@gmail.com>
This commit is contained in:
		
							parent
							
								
									a3faf400e7
								
							
						
					
					
						commit
						a2e5d22b54
					
				
							
								
								
									
										4
									
								
								dist/action.mjs
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										4
									
								
								dist/action.mjs
									
									
									
										generated
									
									
										vendored
									
									
								
							@ -382,9 +382,7 @@ function getContext() {
 | 
				
			|||||||
        configure: {
 | 
					        configure: {
 | 
				
			||||||
            generator: getInput("generator"),
 | 
					            generator: getInput("generator"),
 | 
				
			||||||
            options,
 | 
					            options,
 | 
				
			||||||
            args: getInput("args")
 | 
					            args: shellQuoteExports.parse(getInput("args")).map((arg) => arg.toString()),
 | 
				
			||||||
                .split(/\s+/)
 | 
					 | 
				
			||||||
                .filter((arg) => arg != ""),
 | 
					 | 
				
			||||||
        },
 | 
					        },
 | 
				
			||||||
        build: {
 | 
					        build: {
 | 
				
			||||||
            enabled: getInput("run-build") == "true",
 | 
					            enabled: getInput("run-build") == "true",
 | 
				
			||||||
 | 
				
			|||||||
@ -116,12 +116,12 @@ describe("get action context", () => {
 | 
				
			|||||||
    },
 | 
					    },
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
      name: "with additional arguments specified",
 | 
					      name: "with additional arguments specified",
 | 
				
			||||||
      inputs: { args: "-Wdev -Wdeprecated\n--fresh" },
 | 
					      inputs: { args: `-Wdev -Wdeprecated\n--fresh --foo "bar baz"` },
 | 
				
			||||||
      expectedContext: {
 | 
					      expectedContext: {
 | 
				
			||||||
        configure: {
 | 
					        configure: {
 | 
				
			||||||
          generator: "",
 | 
					          generator: "",
 | 
				
			||||||
          options: [],
 | 
					          options: [],
 | 
				
			||||||
          args: ["-Wdev", "-Wdeprecated", "--fresh"],
 | 
					          args: ["-Wdev", "-Wdeprecated", "--fresh", "--foo", "bar baz"],
 | 
				
			||||||
        },
 | 
					        },
 | 
				
			||||||
      },
 | 
					      },
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
@ -151,7 +151,7 @@ describe("get action context", () => {
 | 
				
			|||||||
        "c-flags": "-Werror -Wall\n-Wextra",
 | 
					        "c-flags": "-Werror -Wall\n-Wextra",
 | 
				
			||||||
        "cxx-flags": "-Werror -Wall\n-Wextra  -Wpedantic",
 | 
					        "cxx-flags": "-Werror -Wall\n-Wextra  -Wpedantic",
 | 
				
			||||||
        options: `BUILD_TESTING=ON BUILD_EXAMPLES=ON\nBUILD_DOCS=ON FOO="BAR BAZ"`,
 | 
					        options: `BUILD_TESTING=ON BUILD_EXAMPLES=ON\nBUILD_DOCS=ON FOO="BAR BAZ"`,
 | 
				
			||||||
        args: "-Wdev -Wdeprecated\n--fresh",
 | 
					        args: `-Wdev -Wdeprecated\n--fresh --foo "bar baz"`,
 | 
				
			||||||
        "run-build": "true",
 | 
					        "run-build": "true",
 | 
				
			||||||
        "build-args": "--target foo\n--parallel  8",
 | 
					        "build-args": "--target foo\n--parallel  8",
 | 
				
			||||||
      },
 | 
					      },
 | 
				
			||||||
@ -170,7 +170,7 @@ describe("get action context", () => {
 | 
				
			|||||||
            "BUILD_DOCS=ON",
 | 
					            "BUILD_DOCS=ON",
 | 
				
			||||||
            "FOO=BAR BAZ",
 | 
					            "FOO=BAR BAZ",
 | 
				
			||||||
          ],
 | 
					          ],
 | 
				
			||||||
          args: ["-Wdev", "-Wdeprecated", "--fresh"],
 | 
					          args: ["-Wdev", "-Wdeprecated", "--fresh", "--foo", "bar baz"],
 | 
				
			||||||
        },
 | 
					        },
 | 
				
			||||||
        build: {
 | 
					        build: {
 | 
				
			||||||
          enabled: true,
 | 
					          enabled: true,
 | 
				
			||||||
 | 
				
			|||||||
@ -49,9 +49,7 @@ export function getContext(): Context {
 | 
				
			|||||||
    configure: {
 | 
					    configure: {
 | 
				
			||||||
      generator: getInput("generator"),
 | 
					      generator: getInput("generator"),
 | 
				
			||||||
      options,
 | 
					      options,
 | 
				
			||||||
      args: getInput("args")
 | 
					      args: parse(getInput("args")).map((arg) => arg.toString()),
 | 
				
			||||||
        .split(/\s+/)
 | 
					 | 
				
			||||||
        .filter((arg) => arg != ""),
 | 
					 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
    build: {
 | 
					    build: {
 | 
				
			||||||
      enabled: getInput("run-build") == "true",
 | 
					      enabled: getInput("run-build") == "true",
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user