Giter Site home page Giter Site logo

shell-rules's Introduction

Shell rules

Shell rules for the Please build system

Usage

The easiest way to get set up is to run plz init plugin shell. This will install the plugin and automatically make the shell rules available in every BUILD file.

Alternatively add the following to plugins/BUILD:

plugin_repo(
  name = "shell",
  version = <latest version here>,
)

And add the following to your .plzconfig:

[Plugin "shell"]
Target = //plugins:shell

And then use subinclude("///shell//build_defs:shell") to make the rules available in a BUILD file.

sh_cmd()

The sh_cmd() rule can be used to run a bash command:

subinclude("///shell//build_defs:shell")

sh_cmd(name="hello_world", cmd="echo Hello, world!")
$ plz run //:hello_world
Hello, world!

sh_binary()

The sh_binary() rules is similar to sh_cmd() however it takes in a .sh file as a source:

subinclude("///shell//build_defs:shell")

sh_binary(
  name = "hello_world",
  srcs = ["hello.sh"],
)

And then add hello.sh:

#!/bin/bash

echo Hello, world!
$ plz run //:hello_world
Hello, world!

sh_test()

The sh_rule() works the same as sh binary, but can provide a test. The .sh file must indicate success or failure via the exit code:

sh_test(
  name = "test",
  src = "test.sh",
)
#!/bin/bash

echo "failure"
exit 1

shell-rules's People

Contributors

peterebden avatar samwestmoreland avatar tatskaari avatar tiagovtristao avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar

shell-rules's Issues

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.