add fd for Mac, Windows 10, Linux
authorAJ ONeal <aj@therootcompany.com>
Tue, 14 Jul 2020 20:42:17 +0000 (20:42 +0000)
committerAJ ONeal <aj@therootcompany.com>
Tue, 14 Jul 2020 20:42:17 +0000 (20:42 +0000)
fd/README.md [new file with mode: 0644]
fd/install.ps1 [new file with mode: 0644]
fd/install.sh [new file with mode: 0644]
fd/releases.js [new file with mode: 0644]

diff --git a/fd/README.md b/fd/README.md
new file mode 100644 (file)
index 0000000..255fbda
--- /dev/null
@@ -0,0 +1,59 @@
+---
+title: fd
+homepage: https://github.com/sharkdp/fd
+tagline: |
+  fd is a git-aware, simple, fast and user-friendly alternative to find.
+---
+
+## Updating
+
+```bash
+webi fd@stable
+```
+
+Use the `@beta` tag for pre-releases.
+
+## Cheat Sheet
+
+![](https://github.com/sharkdp/fd/raw/master/doc/screencast.svg?sanitize=true)
+
+> `fd` is a modern, git-aware, syntax-enabled alternative to `find` that handles
+> unicode, respects `.gitignore`, and ignores hidden directories by default.
+
+### Colorized Recursive List
+
+```bash
+fd
+```
+
+### Case-Insensitive Recursive Search
+
+Anytime you use only lowercase letters, it's case-insensitive by default.
+
+```bash
+fd foo
+```
+
+### Case-Sensitive, Showing all ignored and hidden files
+
+All `.` files and folders, and anything in `.gitignore` are ignored by default.
+
+```bash
+fd -s -I -H foo
+```
+
+### To show only JavaScript and Markdown files
+
+Use `-e` as many times as there are extensions that you want to match.
+
+```bash
+fd -e md -e mkdn -e js -e mjs
+```
+
+### Other options are mostly similar to `find`
+
+For options see:
+
+```bash
+hexyl --help
+```
diff --git a/fd/install.ps1 b/fd/install.ps1
new file mode 100644 (file)
index 0000000..6360ede
--- /dev/null
@@ -0,0 +1,44 @@
+#!/usr/bin/env pwsh
+
+$VERNAME = "$Env:PKG_NAME-v$Env:WEBI_VERSION.exe"
+$EXENAME = "$Env:PKG_NAME.exe"
+# Fetch archive
+IF (!(Test-Path -Path "$Env:USERPROFILE\Downloads\$Env:WEBI_PKG_FILE"))
+{
+    # TODO: arch detection
+    echo "Downloading $Env:PKG_NAME from $Env:WEBI_PKG_URL to $Env:USERPROFILE\Downloads\$Env:WEBI_PKG_FILE"
+    & curl.exe -A "$Env:WEBI_UA" -fsSL "$Env:WEBI_PKG_URL" -o "$Env:USERPROFILE\Downloads\$Env:WEBI_PKG_FILE.part"
+    & move "$Env:USERPROFILE\Downloads\$Env:WEBI_PKG_FILE.part" "$Env:USERPROFILE\Downloads\$Env:WEBI_PKG_FILE"
+}
+
+IF (!(Test-Path -Path "$Env:USERPROFILE\.local\xbin\$VERNAME"))
+{
+    echo "Installing $Env:PKG_NAME"
+    # TODO: temp directory
+
+    # Enter tmp
+    pushd .local\tmp
+
+        # Remove any leftover tmp cruft
+        Remove-Item -Path "$Env:PKG_NAME-v*" -Recurse -ErrorAction Ignore
+
+        # Unpack archive
+        # Windows BSD-tar handles zip. Imagine that.
+        echo "Unpacking $Env:USERPROFILE\Downloads\$Env:WEBI_PKG_FILE"
+        & tar xf "$Env:USERPROFILE\Downloads\$Env:WEBI_PKG_FILE"
+        # Move single binary into root of temporary folder
+        & move "$EXENAME" "$VERNAME"
+        & dir
+
+        # Settle unpacked archive into place
+        echo "New Name: $VERNAME"
+        echo "New Location: $Env:USERPROFILE\.local\xbin\$VERNAME"
+        Move-Item -Path "$VERNAME" -Destination "$Env:USERPROFILE\.local\xbin"
+
+    # Exit tmp
+    popd
+}
+
+echo "Copying into '$Env:USERPROFILE\.local\bin\$EXENAME' from '$Env:USERPROFILE\.local\xbin\$VERNAME'"
+Remove-Item -Path "$Env:USERPROFILE\.local\bin\$EXENAME" -Recurse -ErrorAction Ignore
+Copy-Item -Path "$Env:USERPROFILE\.local\xbin\$VERNAME" -Destination "$Env:USERPROFILE\.local\bin\$EXENAME" -Recurse
diff --git a/fd/install.sh b/fd/install.sh
new file mode 100644 (file)
index 0000000..ad62461
--- /dev/null
@@ -0,0 +1,31 @@
+#!/bin/bash
+
+{
+    set -e
+    set -u
+
+    ###############
+    # Install fd #
+    ###############
+
+    WEBI_SINGLE=true
+
+    pkg_get_current_version() {
+      # 'fd --version' has output in this format:
+      #       fd 8.1.1
+      # This trims it down to just the version number:
+      #       8.1.1
+      echo $(fd --version 2>/dev/null | head -n 1 | cut -d' ' -f 2)
+    }
+
+    pkg_install() {
+        # $HOME/.local/
+        mkdir -p "$pkg_src_bin"
+
+        # mv ./fd-*/fd "$HOME/.local/opt/fd-v8.1.1/bin/fd"
+        mv ./fd-*/fd "$pkg_src_cmd"
+
+        # chmod a+x "$HOME/.local/xbin/rg-v11.1.0"
+        chmod a+x "$pkg_src_cmd"
+    }
+}
diff --git a/fd/releases.js b/fd/releases.js
new file mode 100644 (file)
index 0000000..b712eec
--- /dev/null
@@ -0,0 +1,20 @@
+'use strict';
+
+var github = require('../_common/github.js');
+var owner = 'sharkdp';
+var repo = 'fd';
+
+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));
+  });
+}