RedHatInsights / insights-interact-tools

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Insights Interact Toolkit

Install

Note: The repo can be cloned to anywhere. $HOME is used as default for a global installation.

  1. Clone the repository
$ git clone git@github.com:bastilian/insights-interact-tools.git $HOME/.insights-interact
  1. Install node packages via
$ cd $HOME/.insights-interact && npm install
  1. (optional) Add an alias to your .bashrc or .zshrc:
alias insights-interact="node $HOME/.insights-interact/index.js"

CLI Usage

To see a list of commands and flags use --help

$ insights-interact --help
$ # or without the alias
$ npm run test -- setup init

Initialising

For most scripts to work the repos need to be configured and cloned. This can be done via two commands:

$ insights-interact setup init # Will setup the configuration at `.insights-interact.yml`
$ insights-interact setup apps # Will clone all repositories and install packages

Adding a new command

To add a new command create a JavaScript module exporting an async function in any of the ./commands sub-directories. The command will be executable via

$ insights-interact SUB_DIRECTORY JS_FILENAME

The module can also export a help and flags property to define a help text shown in --help and flags that can be provided

Command module boilerplate

export const flags = {
  flagName: {
    type: "string",
    alias: ["c"],
    description: "Shell command to run",
  },
};

export const help = `
  HELP TEXT
`;

export default async (
  cli, // object returned from meow
  config, // config object created from ~/.insights-interact.yml (or provided config)
) => {
  // Run things run
};

MIT License

Copyright (c) 2022 The contributors

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

About

License:MIT License


Languages

Language:JavaScript 89.4%Language:Python 8.7%Language:Shell 1.9%