bugfix: correct lf unpack and install

This commit is contained in:
AJ ONeal
2021-03-03 07:01:09 +00:00
parent b55c06bfb8
commit b14b716c48
5 changed files with 72 additions and 44 deletions
-31
View File
@@ -1,31 +0,0 @@
#!/bin/bash
function __init_lf() {
set -e
set -u
##################
# Install lf #
##################
pkg_cmd_name="lf"
pkg_dst_cmd="$HOME/.local/bin/lf"
pkg_dst="$pkg_dst_cmd"
pkg_src_cmd="$HOME/.local/opt/lf-v$WEBI_VERSION/bin/lf"
pkg_src_dir="$HOME/.local/opt/lf-v$WEBI_VERSION"
pkg_src="$pkg_src_cmd"
pkg_install() {
mkdir -p "$(dirname $pkg_src_cmd)"
mv ./lf-*/lf "$pkg_src_cmd"
}
pkg_get_current_version() {
echo $(lf --version 2>/dev/null | head -n 1 | cut -d ' ' -f 2)
}
}
__init_lf
+13 -8
View File
@@ -5,20 +5,23 @@ tagline: |
lf: terminal file manager written in Go
---
To update or switch versions, run `webi lf@stable` (or `@v2`, `@beta`,
etc).
To update or switch versions, run `webi lf@stable` (or `@v2`, `@beta`, etc).
## Cheat Sheet
> lf (as in "list files") is a terminal file manager written in Go. It is heavily inspired by ranger with some missing and extra features.
> lf (as in "list files") is a terminal file manager written in Go. It is
> heavily inspired by ranger with some missing and extra features.
To start the application in the current directory:
```bash
lf
```
### Navigating in lf:
| Action | Command/Key |
|-----------|-------------|
| Action | Command/Key |
| --------- | ------------------ |
| quit | 'q' |
| up | 'k' or '\<up>' |
| page-up | '\<pgup>' |
@@ -28,14 +31,16 @@ lf
| open | 'l' or '\<right>' |
| top | 'gg' and '\<home>' |
| bottom | 'G' and '\<end>' |
|||
| | |
### For command line options:
```bash
lf -help
lf --help
```
### For documentation
```bash
lf -doc
lf --doc
```
+3 -4
View File
@@ -1,8 +1,8 @@
#!/usr/bin/env pwsh
##################
##############
# Install lf #
##################
##############
$pkg_cmd_name = "lf"
@@ -29,7 +29,6 @@ IF (!(Test-Path -Path "$pkg_src_cmd"))
pushd .local\tmp
Remove-Item -Path ".\lf-v*" -Recurse -ErrorAction Ignore
Remove-Item -Path ".\lf.exe" -Recurse -ErrorAction Ignore
echo "Unpacking $pkg_download"
@@ -37,7 +36,7 @@ IF (!(Test-Path -Path "$pkg_src_cmd"))
echo "Install Location: $pkg_src_cmd"
New-Item "$pkg_src_bin" -ItemType Directory -Force
Move-Item -Path ".\lf-*\lf.exe" -Destination "$pkg_src_bin"
Move-Item -Path ".\lf.exe" -Destination "$pkg_src_bin"
popd
}
+42
View File
@@ -0,0 +1,42 @@
#!/bin/bash
function __init_lf() {
set -e
set -u
##############
# Install lf #
##############
# Every package should define these 6 variables
pkg_cmd_name="lf"
pkg_dst_cmd="$HOME/.local/bin/lf"
pkg_dst="$pkg_dst_cmd"
pkg_src_cmd="$HOME/.local/opt/lf-v$WEBI_VERSION/bin/lf"
pkg_src_dir="$HOME/.local/opt/lf-v$WEBI_VERSION"
pkg_src="$pkg_src_cmd"
pkg_install() {
# $HOME/.local/opt/lf-v0.21.0/bin
mkdir -p "$(dirname $pkg_src_cmd)"
# mv ./lf "$HOME/.local/opt/lf-v0.21.0/bin/lf"
mv ./lf "$pkg_src_cmd"
# chmod a+x "$HOME/.local/opt/lf-v0.21.0/bin/lf"
chmod a+x "$pkg_src_cmd"
}
pkg_get_current_version() {
# 'lf version' has output in this format:
# r21
# This treats it as a minor version number:
# 0.21.0
echo "0.$(lf --version 2>/dev/null | head -n 1 | cut -d' ' -f1 | sed 's:^r::').0"
}
}
__init_lf
+14 -1
View File
@@ -6,6 +6,13 @@ var repo = 'lf';
module.exports = function (request) {
return github(request, owner, repo).then(function (all) {
all.releases = all.releases.map(function (r) {
// r21 -> 0.21.0
if (/^r/.test(r.version)) {
r.version = '0.' + r.version.replace('r', '') + '.0';
}
return r;
});
return all;
});
};
@@ -13,7 +20,13 @@ module.exports = function (request) {
if (module === require.main) {
module.exports(require('@root/request')).then(function (all) {
all = require('../_webi/normalize.js')(all);
all.releases = all.releases.slice(0, 5);
all.releases = all.releases
.filter(function (r) {
return (
['windows', 'macos', 'linux'].includes(r.os) && 'amd64' === r.arch
);
})
.slice(0, 10);
console.info(JSON.stringify(all, null, 2));
});
}