add bat
authorAJ ONeal <aj@therootcompany.com>
Sun, 5 Jul 2020 01:12:07 +0000 (01:12 +0000)
committerAJ ONeal <aj@therootcompany.com>
Sun, 5 Jul 2020 01:12:07 +0000 (01:12 +0000)
bat/README.md [new file with mode: 0644]
bat/install.sh [new file with mode: 0644]
bat/releases.js [new file with mode: 0644]

diff --git a/bat/README.md b/bat/README.md
new file mode 100644 (file)
index 0000000..232a2ac
--- /dev/null
@@ -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 (file)
index 0000000..b9a6067
--- /dev/null
@@ -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 (file)
index 0000000..9e64ace
--- /dev/null
@@ -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));
+  });
+}