Git Product home page Git Product logo

confirm-before's Introduction

No? Confirm Before

Sanity check for your shell commands

Installing

brew tap marceloboeira/formulas
brew install marceloboeira/formulas/confirm-before

Motivation

I have recently started working with a lot of DevOps CLIs that interact with staging and production servers.

My shell setup includes aliases like:

alias ks=`kubectl --context staging`
alias kp=`kubectl --context production`

However, I frequently find myself almost running something wrong by not paying attention if its production/staging. Therefore, I decided to create this small 'command wrapper' for me to make sure if I really want to run that command against production. e.g.:

alias kp=`confirm-before kubectl --context production`

Then, ...

$ kp apply -F *
Are you sure? (y/n)

Future

I might create other sanity check levels/modes:

$ alias dangerous=`confirm-before --math dangerous --production`
$ dangerous get foo
How much is 19 - 3?

Conditionals, because it can become very annoying to confirm read-only commands...

$ alias dangerous=`confirm-before --matching delete|d|rm|apply dangerous --production`
$ dangerous delete foo
Are you sure? (y/n)
...
$ dangerous get foo -> doesn't match the regexp

confirm-before's People

Contributors

marceloboeira avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

confirm-before's Issues

Bug: Unable to use a TTY

[master] λ kp attach pod-foo-bar -it
Are you sure? (y/n) y

Unable to use a TTY - input is not a terminal or the right kind of file
If you don't see a command prompt, try pressing enter

Bug: missing stdout when grep

$ kp get pods | grep web-app

Nothing shows up, but if I press y and enter it works... I guess the stdout is sending the confirmation to grep instead of actually asking...

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.