Giter Site home page Giter Site logo

option-mapper's Introduction

option-mapper

Maps multiple instances of the same command line option to multiple invocation of a target program.

I.e.


option-mapper.sh. --map-option=1 --map-option=2 --map-option=3 --common-option-one=one --common-option-two=two

Will be mapped into threee invocations of the target program as following:

target.sh --map-option=1 --common-option-one=one --common-option-two=two
target.sh --map-option=2 --common-option-one=one --common-option-two=two
target.sh --map-option=3 --common-option-one=one --common-option-two=two

Mapper supports dependent options to prevent collisions between multiple invocations.

Example:

option-mapper.sh. --map-option=1 --map-option=2 --map-option=3 --common-option-two=one --dependent-option-one=two

Will be mapped as following:

target.sh --map-option=1 --common-option-one=one --dependent-option-one=invocation_1_two
target.sh --map-option=2 --common-option-one=one --dependent-option-one=invocation_2_two
target.sh --map-option=3 --common-option-one=one --dependent-option-one=invocation_3_two

Synopsys Detect Example

detect-example.sh will utilize option mapper to allow specifying multiple --detect.source.path options at once.

This will place scans generated by each invocation of synopsys detect under the same project and version.

PowerShell Detect example

detect-option-mapper.ps1 will implement similar functionality with windows PowerShell

E.g.


   & .\detect-option-mapper.ps1 `
     --detect.source.path=part1 `
     --detect.source.path=part2 `
	   --detect.source.path='part 3'  `
	   --blackduck.trust.cert=true `
	   --blackduck.url='https://ec2-3-236-71-181.compute-1.amazonaws.com' `
	   --blackduck.api.token='MTNlMDZhMjItNmU3ZC00OThhLWJkMGItOGNjZjE5YTg5N2UzOmM3ZmJjZDZmLWVkODUtNDZiYS1hZjE2LWQ4NGNjMGQ2NGI0NA==' `
	   --detect.project.name=FOO `
	   --detect.project.version.name=BAR

Will be translated into the following invocation sequence:

    powershell "[Net.ServicePointManager]::SecurityProtocol = 'tls12'; Invoke-RestMethod https://detect.synopsys.com/detect.ps1?$(Get-Random) | Invoke-Expression ; detect " `
	--detect.source.path=part1 `
	--blackduck.trust.cert=true `
	--blackduck.url=https://ec2-3-236-71-181.compute-1.amazonaws.com `
	--blackduck.api.token=MTNlMDZhMjItNmU3ZC00OThhLWJkMGItOGNjZjE5YTg5N2UzOmM3ZmJjZDZmLWVkODUtNDZiYS1hZjE2LWQ4NGNjMGQ2NGI0NA== `
	--detect.project.name=FOO `
	--detect.project.version.name=BAR

. . .
    powershell "[Net.ServicePointManager]::SecurityProtocol = 'tls12'; Invoke-RestMethod https://detect.synopsys.com/detect.ps1?$(Get-Random) | Invoke-Expression ; detect " `
	--detect.source.path=part2 `
	--blackduck.trust.cert=true `
	--blackduck.url=https://ec2-3-236-71-181.compute-1.amazonaws.com `
	--blackduck.api.token=MTNlMDZhMjItNmU3ZC00OThhLWJkMGItOGNjZjE5YTg5N2UzOmM3ZmJjZDZmLWVkODUtNDZiYS1hZjE2LWQ4NGNjMGQ2NGI0NA== `
	--detect.project.name=FOO `
	--detect.project.version.name=BAR

. . .
    powershell "[Net.ServicePointManager]::SecurityProtocol = 'tls12'; Invoke-RestMethod https://detect.synopsys.com/detect.ps1?$(Get-Random) | Invoke-Expression ; detect " `
	--detect.source.path=part` 3 `
	--blackduck.trust.cert=true `
	--blackduck.url=https://ec2-3-236-71-181.compute-1.amazonaws.com `
	--blackduck.api.token=MTNlMDZhMjItNmU3ZC00OThhLWJkMGItOGNjZjE5YTg5N2UzOmM3ZmJjZDZmLWVkODUtNDZiYS1hZjE2LWQ4NGNjMGQ2NGI0NA== `
	--detect.project.name=FOO `
	--detect.project.version.name=BAR

. . .

option-mapper's People

Contributors

mkumykov avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.