mirror of
				https://github.com/threeal/cmake-action.git
				synced 2025-11-03 21:33: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: {
 | 
			
		||||
            generator: getInput("generator"),
 | 
			
		||||
            options,
 | 
			
		||||
            args: getInput("args")
 | 
			
		||||
                .split(/\s+/)
 | 
			
		||||
                .filter((arg) => arg != ""),
 | 
			
		||||
            args: shellQuoteExports.parse(getInput("args")).map((arg) => arg.toString()),
 | 
			
		||||
        },
 | 
			
		||||
        build: {
 | 
			
		||||
            enabled: getInput("run-build") == "true",
 | 
			
		||||
 | 
			
		||||
@ -116,12 +116,12 @@ describe("get action context", () => {
 | 
			
		||||
    },
 | 
			
		||||
    {
 | 
			
		||||
      name: "with additional arguments specified",
 | 
			
		||||
      inputs: { args: "-Wdev -Wdeprecated\n--fresh" },
 | 
			
		||||
      inputs: { args: `-Wdev -Wdeprecated\n--fresh --foo "bar baz"` },
 | 
			
		||||
      expectedContext: {
 | 
			
		||||
        configure: {
 | 
			
		||||
          generator: "",
 | 
			
		||||
          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",
 | 
			
		||||
        "cxx-flags": "-Werror -Wall\n-Wextra  -Wpedantic",
 | 
			
		||||
        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",
 | 
			
		||||
        "build-args": "--target foo\n--parallel  8",
 | 
			
		||||
      },
 | 
			
		||||
@ -170,7 +170,7 @@ describe("get action context", () => {
 | 
			
		||||
            "BUILD_DOCS=ON",
 | 
			
		||||
            "FOO=BAR BAZ",
 | 
			
		||||
          ],
 | 
			
		||||
          args: ["-Wdev", "-Wdeprecated", "--fresh"],
 | 
			
		||||
          args: ["-Wdev", "-Wdeprecated", "--fresh", "--foo", "bar baz"],
 | 
			
		||||
        },
 | 
			
		||||
        build: {
 | 
			
		||||
          enabled: true,
 | 
			
		||||
 | 
			
		||||
@ -49,9 +49,7 @@ export function getContext(): Context {
 | 
			
		||||
    configure: {
 | 
			
		||||
      generator: getInput("generator"),
 | 
			
		||||
      options,
 | 
			
		||||
      args: getInput("args")
 | 
			
		||||
        .split(/\s+/)
 | 
			
		||||
        .filter((arg) => arg != ""),
 | 
			
		||||
      args: parse(getInput("args")).map((arg) => arg.toString()),
 | 
			
		||||
    },
 | 
			
		||||
    build: {
 | 
			
		||||
      enabled: getInput("run-build") == "true",
 | 
			
		||||
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user