Giter Site home page Giter Site logo

thaljef / synopsys-detect-bash-completion Goto Github PK

View Code? Open in Web Editor NEW
3.0 2.0 1.0 23 KB

Command completion for Synopsys (Black Duck) Detect commands

Home Page: https://synopsys.atlassian.net/wiki/spaces/INTDOCS/pages/62423113/Synopsys+Detect

Shell 100.00%
bash-completion blackduck synopsys security-tools

synopsys-detect-bash-completion's Introduction

Bash Completion For Synopsys (Black Duck) Detect

Suggests options and parameters to complete Synopsys (Black Duck) Detect commands.

Installation

In all cases, you simply need to install the appropriate bash completion package (if not already installed) and then copy the detect completion script from this repository into the right directory for your system. For example:

sudo apt install bash-completion
sudo sh -c 'curl -sL https://raw.githubusercontent.com/thaljef/synopsys-detect-bash-completion/master/detect > /etc/bash_completion.d/detect'
bash -l; # To start new shell

In some cases, you may need to explicitly load the completion framework into your shell. This is usually done by adding something like source /etc/bash_completion to your ~\.bashrc file.

The actual directory for your bash completion scripts and the exact command to load them into your shell will vary by Linux distro and version. The above is just an example; consult your distro docs for more specific guidance.

Usage

The bash completion mechanism relies on having a named command to bind the completions to. However, it is customary to execute Detect via a remote bootstrapping script. This execution process cannot be used with bash completion.

Therefore, it is necessary to do that bootstrapping in a named command in order to use these completions for Detect. The following must be placed in an executable file named detect and that file should be in a directory that is in your $PATH:

#!/bin/bash

bash <(curl -s -L https://detect.synopsys.com/detect7.sh) $*

Examples

Option names:

$> detect --detect.docker.[TAB][TAB]
--detect.docker.image=                   --detect.docker.inspector.version=    --detect.docker.tar=
--detect.docker.inspector.air.gap.path=  --detect.docker.path.required=
--detect.docker.inspector.path=          --detect.docker.path=

Option parameters:

$> detect --detect.project.tier=[TAB][TAB]
1  2  3  4  5

$> detect --detect.trust.cert=[TAB][TAB]
false  true

Option parameter lists:

$> detect --detect.project.tools=[TAB][TAB]
ALL             BINARY_SCAN     DOCKER          POLARIS
BAZEL           DETECTOR        NONE            SIGNATURE_SCAN

$> detect --detect.project.tools=DOCKER,[TAB][TAB]
DOCKER,BAZEL           DOCKER,DETECTOR        DOCKER,SIGNATURE_SCAN
DOCKER,BINARY_SCAN     DOCKER,POLARIS

Compatibility

This completion script is known to work with bash 4.x or 5.x which is found in any recent Linux distro. It will probably work with recent versions of zsh too. It will probably not work with bash 3.x or older. For Windows, use either Cygwin or the Linux Subsytem for Windows 10 to get a compatible shell. MacOS has an ancient version of bash, so you'll probably need to install homebrew and install both the bash and bash-completion2 brews.

Caveats

  • The completions are derived from the documentation for Detect. But the options described in the documentation don't always agree with the implementation. So you may encounter options that are not correctly completed, or completed options that are not supported.

  • The Detect bootstrapping optionally uses certain environment variables. Ideally, those same variables should be used here too. But at the moment, they are not. So if you use those variables, it may affect the completions.

Author

Jeffrey Ryan Thalhammer [email protected]

Copyright

2019 (C) Jeffrey Ryan Thalhammer

synopsys-detect-bash-completion's People

Contributors

thaljef avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

petergreen86

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.