This is the multi-page printable view of this section. Click here to print.

Return to the regular view of this page.

Sh

Shell rules

1 - al_sh_library

al_sh_library

load("@com_alwaldend_src//bzl/rules/sh:al_sh_library.bzl", "al_sh_library")

al_sh_library(name, shfmt_src, editorconfig_src, shellcheck_src, run_args_src, visibility,
              **common_kwargs)

Create targets for a shell library

Targets:

  • ${name}-shfmt-fix: executable to run shfmt
  • ${name}-shfmt-test: test whether the script is formatted
  • ${name}-shellcheck-test: shellcheck test

PARAMETERS

Name Description Default Value
name target name none
shfmt_src

-

"@cc_mvdan_sh_v3//cmd/shfmt:shfmt"
editorconfig_src

-

"//:editorconfig"
shellcheck_src

-

"@com_github_koalaman_shellcheck_linux_x86_64//:bin"
run_args_src

-

"//sh/scripts:run-args.lib"
visibility

-

["//visibility:public"]
common_kwargs kwargs for both targets none

2 - al_write_script

al_write_script

load("@com_alwaldend_src//bzl/rules/sh:al_write_script.bzl", "al_write_script")

al_write_script(name, out, content, make_vars, set_flags, shebang)

Write a script and make it executable

ATTRIBUTES

Name Description Type Mandatory Default
name A unique name for this target. Name required
out Output file Label; nonconfigurable required
content Script content String required
make_vars Additional make vars Dictionary: String -> String optional {}
set_flags Flags to pass to set List of strings optional ["-eu"]
shebang Sheband to use String optional "#!/usr/bin/env sh"

3 - Bazel targets

NameInfo
al_sh_library
locationbzl/rules/sh/BUILD.bazel:11:19
name//bzl/rules/sh:al_sh_library
ruleClassbzl_library
visibility
  • //visibility:public
al_sh_library.stardoc
locationbzl/rules/sh/BUILD.bazel:11:19
name//bzl/rules/sh:al_sh_library.stardoc
ruleClassgenrule
ruleOutput
  • //bzl/rules/sh:al_sh_library.stardoc.md
visibility
  • //visibility:private
al_sh_library.stardoc_raw
locationbzl/rules/sh/BUILD.bazel:11:19
name//bzl/rules/sh:al_sh_library.stardoc_raw
ruleClassstardoc_markdown_renderer
ruleOutput
  • //bzl/rules/sh:al_sh_library.stardoc_raw.md
visibility
  • //visibility:private
al_sh_library.stardoc_raw.extract
locationbzl/rules/sh/BUILD.bazel:11:19
name//bzl/rules/sh:al_sh_library.stardoc_raw.extract
ruleClassstarlark_doc_extract
ruleOutput
  • //bzl/rules/sh:al_sh_library.stardoc_raw.extract.binaryproto
  • //bzl/rules/sh:al_sh_library.stardoc_raw.extract.textproto
visibility
  • //visibility:private
al_write_script
locationbzl/rules/sh/BUILD.bazel:11:19
name//bzl/rules/sh:al_write_script
ruleClassbzl_library
visibility
  • //visibility:public
al_write_script.stardoc
locationbzl/rules/sh/BUILD.bazel:11:19
name//bzl/rules/sh:al_write_script.stardoc
ruleClassgenrule
ruleOutput
  • //bzl/rules/sh:al_write_script.stardoc.md
visibility
  • //visibility:private
al_write_script.stardoc_raw
locationbzl/rules/sh/BUILD.bazel:11:19
name//bzl/rules/sh:al_write_script.stardoc_raw
ruleClassstardoc_markdown_renderer
ruleOutput
  • //bzl/rules/sh:al_write_script.stardoc_raw.md
visibility
  • //visibility:private
al_write_script.stardoc_raw.extract
locationbzl/rules/sh/BUILD.bazel:11:19
name//bzl/rules/sh:al_write_script.stardoc_raw.extract
ruleClassstarlark_doc_extract
ruleOutput
  • //bzl/rules/sh:al_write_script.stardoc_raw.extract.binaryproto
  • //bzl/rules/sh:al_write_script.stardoc_raw.extract.textproto
visibility
  • //visibility:private
changelog
locationbzl/rules/sh/BUILD.bazel:6:17
name//bzl/rules/sh:changelog
ruleClasspkg_filegroup
visibility
  • //visibility:public
changelog.changelog
locationbzl/rules/sh/BUILD.bazel:6:17
name//bzl/rules/sh:changelog.changelog
ruleClassal_template_files
ruleOutput
  • //bzl/rules/sh:changelog.doc.md
visibility
  • //visibility:private
changelog.changelog_data
locationbzl/rules/sh/BUILD.bazel:6:17
name//bzl/rules/sh:changelog.changelog_data
ruleClassal_git_run_binary
ruleOutput
  • //bzl/rules/sh:changelog.changelog_data.yaml
visibility
  • //visibility:private
changelog.changelog_files
locationbzl/rules/sh/BUILD.bazel:6:17
name//bzl/rules/sh:changelog.changelog_files
ruleClasspkg_files
visibility
  • //visibility:private
changelog.template
locationbzl/rules/sh/BUILD.bazel:6:17
name//bzl/rules/sh:changelog.template
ruleClass_write_file
ruleOutput
  • //bzl/rules/sh:changelog.template.md
visibility
  • //visibility:private
libs
locationbzl/rules/sh/BUILD.bazel:11:19
name//bzl/rules/sh:libs
ruleClassbzl_library
visibility
  • //visibility:public
libs.stardoc
locationbzl/rules/sh/BUILD.bazel:11:19
name//bzl/rules/sh:libs.stardoc
ruleClasspkg_filegroup
visibility
  • //visibility:public
libs.stardoc_src
locationbzl/rules/sh/BUILD.bazel:11:19
name//bzl/rules/sh:libs.stardoc_src
ruleClasspkg_files
visibility
  • //visibility:private
readme
locationbzl/rules/sh/BUILD.bazel:22:10
name//bzl/rules/sh:readme
ruleClassfilegroup
visibility
  • //visibility:public
readme.srcs
locationbzl/rules/sh/BUILD.bazel:22:10
name//bzl/rules/sh:readme.srcs
ruleClasspkg_files
visibility
  • //visibility:private
readme.with_children
locationbzl/rules/sh/BUILD.bazel:22:10
name//bzl/rules/sh:readme.with_children
ruleClasspkg_filegroup
visibility
  • //visibility:public

4 - Changelog

  • Add external ansible collections, rename some deps (99b3c7)
  • Move changelog rules to bzl/rules/git, improve ansible rules (c94123)
  • Move ansible and leetcode rules to bzl/rules (0d9b39)
  • Move changelog rules to bzl/rules/changelog (4d59d6)
  • Move readme rules to bzl/rules/readme (95ea8d)
  • Move bzl rules to bzl/rules/bzl (57930e)
  • Move sh rules to bzl/rules/sh (8e6a6a)