Code Monkey home page Code Monkey logo

dotbot-if's Introduction

Dotbot if Plugin

Conditional execution of Dotbot directives based on a shell command's exit status (success or failure). Inspired by dotbot-ifplatform.

Prerequisites

This plugin requires Dotbot to be installed.

Installation

  1. Run git submodule add https://github.com/wonderbeyond/dotbot-if.git
  2. Run git submodule update --init --recursive
  3. Pass in the CLI argument -p dotbot-if/if.py when calling the dotbot executable.

Usage

Add the if..cond..met..unmet structure in the dotbot YAML file to conditionally execute any other directives. For examples:

The if..else equivalent

You can omit any met or unmet part if you want do nothing at that state.

- if:
    cond: 'python -V | grep -Eq "Python\s+3\."'
    met:
    - shell:
      - echo Found Python 3.
    unmet:
    - shell:
      - echo Python3 not found!

Multiple parameter groups for single if

Can be the switch/match..case equivalent.

- if:
  - cond: 'command -v apt-get'
    met:
    - apt:
      - jq
  - cond: 'command -v brew'
    met:
    - brew:
      - jq

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.