From da8e2a58641786de373d32543a5296eb1b922fbf Mon Sep 17 00:00:00 2001 From: AJ ONeal Date: Sun, 5 Jul 2020 01:12:07 +0000 Subject: [PATCH] add bat --- bat/README.md | 39 +++++++++++++++++++++++++++++++++++++++ bat/install.sh | 31 +++++++++++++++++++++++++++++++ bat/releases.js | 20 ++++++++++++++++++++ 3 files changed, 90 insertions(+) create mode 100644 bat/README.md create mode 100644 bat/install.sh create mode 100644 bat/releases.js diff --git a/bat/README.md b/bat/README.md new file mode 100644 index 0000000..232a2ac --- /dev/null +++ b/bat/README.md @@ -0,0 +1,39 @@ +--- +title: bat +homepage: https://github.com/sharkdp/bat +tagline: | + bat: A cat(1) clone with syntax highlighting and Git integration. +description: | + `bat` is pretty much what `cat` would be if it were developed today in the world of Markdown, git, etc. +--- + +## How to alias as `cat` + +Update your `.bashrc`, `.zshrc`, or `.profile` + +```bash +alias cat="bat --style=plain" +``` + +## How to change the default behavior + +Take a look at the config options: + +```bash +bat --help +``` + +Check to see where your config file is: + +```bash +echo 'N' | bat --generate-config-file +``` + +Edit the config file: + +`~/.config/bat/config`: + +```txt +# no numbers or headers, just highlighting and such +--style="plain" +``` diff --git a/bat/install.sh b/bat/install.sh new file mode 100644 index 0000000..b9a6067 --- /dev/null +++ b/bat/install.sh @@ -0,0 +1,31 @@ +#!/bin/bash + +{ + set -e + set -u + + ############### + # Install bat # + ############### + + WEBI_SINGLE=true + + pkg_get_current_version() { + # 'bat --version' has output in this format: + # bat 0.15.4 + # This trims it down to just the version number: + # 0.15.4 + echo $(bat --version 2>/dev/null | head -n 1 | cut -d' ' -f 2) + } + + pkg_install() { + # $HOME/.local/xbin + mkdir -p "$pkg_src_bin" + + # mv ./bat-*/bat "$HOME/.local/xbin/bat-v0.15.4" + mv ./bat-*/bat "$pkg_src_cmd" + + # chmod a+x "$HOME/.local/xbin/rg-v11.1.0" + chmod a+x "$pkg_src_cmd" + } +} diff --git a/bat/releases.js b/bat/releases.js new file mode 100644 index 0000000..9e64ace --- /dev/null +++ b/bat/releases.js @@ -0,0 +1,20 @@ +'use strict'; + +var github = require('../_common/github.js'); +var owner = 'sharkdp'; +var repo = 'bat'; + +module.exports = function (request) { + return github(request, owner, repo).then(function (all) { + return all; + }); +}; + +if (module === require.main) { + module.exports(require('@root/request')).then(function (all) { + all = require('../_webi/normalize.js')(all); + all.releases = all.releases.slice(0, 10); + //console.info(JSON.stringify(all)); + console.info(JSON.stringify(all, null, 2)); + }); +} -- 2.25.1