Compare commits

...

22 Commits

Author SHA1 Message Date
Pablo Santiago Blum de Aguiar e33beaaf4f fixup! doctor: check if Git remotes match db URLs 3 years ago
Itzik Ephraim c71f87bb7e doctor: check if Git remotes match db URLs
Co-authored-by: Pablo Santiago Blum de Aguiar <scorphus@gmail.com>
2 years ago
Manu [tennox] 90f875e02d Support installing repo from URL with non-master branch
Somewhat related to #905 and #685
2 years ago
Simon Plakolb 55da5f7b6f Fix cutting of paths with equals signs
Cut splits by equals sign and takes the second field. This ignores path
contents after a second equals sign. Currently this prevents the
installation on NixOS as the nix store path automatically contains a
"=".

This PR instead selects all but the first field and equals sign, leaving
the passed paths as intended.
2 years ago
Pablo Santiago Blum de Aguiar 252566fd68 workflow: Include macos-12 to the matrix 2 years ago
Pablo Santiago Blum de Aguiar 0eeacf0684 omf.packages.name: Fix regex by escaping a dot
Fix #901
2 years ago
Pablo Santiago Blum de Aguiar dc9d2c32d5 Remove leading path element when extracting tarball
Ref.: #787
3 years ago
Pablo Santiago Blum de Aguiar 8ad49c583b Create OMF_PATH when installing offline
Fix #787
3 years ago
Pablo Santiago Blum de Aguiar 37a208177e workflow: Use actions/checkout@3 2 years ago
Pablo Santiago Blum de Aguiar 5e1a4bfc47 workflow: Add ubuntu-20.04 to OS group 2 years ago
Pablo Santiago Blum de Aguiar 32a7e595be workflow: Add brew to path for Ubuntu 2 years ago
Pablo Santiago Blum de Aguiar d428b723c8 omf.cli.install: Set theme when installed from URL
Co-authored-by: Fabian Homborg <FHomborg@gmail.com>
2 years ago
fdeitylink 029a67518d packages: allow installing with github 'user/repo' 2 years ago
fdeitylink 0cda2c0c1f packages: support {$pkg}_uninstall events
Emit uninstall events independent of uninstall.fish
2 years ago
Karan Verma b27b3b5aba
Require bundle package after install (#863)
* Require bundle package after install

* Require bundle package after install

* Require bundle package after install

* Require bundle package after install

* Require bundle package after install

* Require bundle package after install

* remove whitespace

Co-authored-by: Pablo Aguiar <scorphus@gmail.com>

Co-authored-by: Derek W. Stavis <dekestavis@gmail.com>
Co-authored-by: Pablo Aguiar <scorphus@gmail.com>
2 years ago
Emily Grace Seville ab05441000
docs: remove Slack status badge (#883) 2 years ago
jjangga0214 446a94a766
docs: rm unnecessary img tag from readme (#859) 2 years ago
jjangga0214 700f7cad54
chore: ignore if only **.md is editted (#860) 2 years ago
Pablo Aguiar 7aee034a80 Create SECURITY.md 2 years ago
Pablo Santiago Blum de Aguiar 05616d85e9 README: Use GitHub for the install script
Relying on some external domain seems like a bad idea after so many
recurring issues. We're certainly better off with a slightly longer URL.

Fix #867
3 years ago
Pablo Santiago Blum de Aguiar da109ff44e workflow: Update virtual environments 3 years ago
Brian Thompson 59de68c4ca
Change to correct argument to report accurate error message (#853)
* Change to correct argument to report accurate error message

* Update pkg/omf/functions/cli/omf.cli.theme.fish

Co-authored-by: Pablo Aguiar <scorphus@gmail.com>

Co-authored-by: Pablo Aguiar <scorphus@gmail.com>
3 years ago

@ -1,12 +1,17 @@
name: Build
on: [push, pull_request]
on:
push:
paths-ignore:
- '**.md'
pull_request:
paths-ignore:
- '**.md'
jobs:
build:
strategy:
fail-fast: false
matrix:
os:
- ubuntu-16.04
- ubuntu-18.04
- ubuntu-20.04
- ubuntu-latest
@ -21,14 +26,22 @@ jobs:
- os: ubuntu-latest
fish: 2
include:
- os: macos-10.15
fish: brew
- os: macos-latest
fish: brew
- os: macos-11
fish: brew
- os: macos-12
fish: brew
runs-on: ${{ matrix.os }}
steps:
- name: Checkout the repository
uses: actions/checkout@v2
uses: actions/checkout@v3
- name: Add brew to path for Ubuntu
if: startsWith(matrix.os, 'ubuntu') && matrix.fish == 'brew'
run: |
echo "/home/linuxbrew/.linuxbrew/bin" >> $GITHUB_PATH
echo "/home/linuxbrew/.linuxbrew/sbin" >> $GITHUB_PATH
- name: Install Fish
run: FISH_RELEASE=${{ matrix.fish }} tools/ci-install-fish.sh

@ -3,7 +3,7 @@
> The <a href="http://fishshell.com">Fishshell</a> Framework
[![MIT License](https://img.shields.io/badge/license-MIT-007EC7.svg?style=flat-square)](/LICENSE) [![Fish Shell Version](https://img.shields.io/badge/fish-≥v2.2.0-007EC7.svg?style=flat-square)](http://fishshell.com) [![Build](https://github.com/oh-my-fish/oh-my-fish/workflows/Build/badge.svg)](https://github.com/oh-my-fish/oh-my-fish/actions?query=workflow%3ABuild) [![Slack Status](https://oh-my-fish-slack.herokuapp.com/badge.svg)](https://oh-my-fish-slack.herokuapp.com)
[![MIT License](https://img.shields.io/badge/license-MIT-007EC7.svg?style=flat-square)](/LICENSE) [![Fish Shell Version](https://img.shields.io/badge/fish-≥v2.2.0-007EC7.svg?style=flat-square)](http://fishshell.com) [![Build](https://github.com/oh-my-fish/oh-my-fish/workflows/Build/badge.svg)](https://github.com/oh-my-fish/oh-my-fish/actions?query=workflow%3ABuild)
Oh My Fish provides core infrastructure to allow you to install packages which extend or modify the look of your shell. It's fast, extensible and easy to use.
@ -31,13 +31,13 @@ Oh My Fish provides core infrastructure to allow you to install packages which e
You can get started right away with the default setup by running this in your terminal:
```fish
curl -L https://get.oh-my.fish | fish
curl https://raw.githubusercontent.com/oh-my-fish/oh-my-fish/master/bin/install | fish
```
This will download the installer script and start the installation. Alternatively, you can download the installer and customize your install:
```fish
curl -L https://get.oh-my.fish > install
curl https://raw.githubusercontent.com/oh-my-fish/oh-my-fish/master/bin/install > install
fish install --path=~/.local/share/omf --config=~/.config/omf
```
@ -55,7 +55,7 @@ $ git clone https://github.com/oh-my-fish/oh-my-fish
$ cd oh-my-fish
$ bin/install --offline
# with a tarball
$ curl -L https://get.oh-my.fish > install
$ curl https://raw.githubusercontent.com/oh-my-fish/oh-my-fish/master/bin/install > install
$ fish install --offline=omf.tar.gz
```
@ -86,11 +86,12 @@ Update Oh My Fish, all package repositories, and all installed packages.
- For selective package update, list only the names of packages you wish to
update. You may still include "omf" in the list to update the core as well.
#### `omf install` _`[<name>|<url>]`_
#### `omf install` _`[<name>|<url>|<user/repo>]`_
Install one _or more_ packages.
- You can install packages directly by URL via `omf install URL`
- You can install packages from a GitHub repository via `omf install user/repo`
- When called without arguments, install missing packages from [bundle](#dotfiles).
#### `omf repositories` _`[list|add|remove]`_
@ -107,7 +108,7 @@ Apply a theme. To list available themes, type `omf theme`. You can also [preview
#### `omf remove` _`<name>`_
Remove a theme or package.
Remove a theme or package. If a package was installed via `user/repo`, use `repo` for `name`.
> Packages can use uninstall hooks, so custom cleanup of resources can be done when uninstalling it. See [Uninstall](/docs/en-US/Packages.md#uninstall) for more information.

@ -0,0 +1,23 @@
# Security Policy
<!-- ## Supported Versions
Use this section to tell people about which versions of your project are
currently being supported with security updates.
| Version | Supported |
| ------- | ------------------ |
| 5.1.x | :white_check_mark: |
| 5.0.x | :x: |
| 4.0.x | :white_check_mark: |
| < 4.0 | :x: | -->
## Reporting a Vulnerability
To report a vulnerability, please contact the current maintainer:
https://github.com/scorphus (keybase: https://keybase.io/pablito)
<!-- Tell them where to go, how often they can expect to get an update on a
reported vulnerability, what to expect if the vulnerability is accepted or
declined, etc. -->

@ -54,13 +54,13 @@ Options:
set -g OMF_CHANNEL dev
case '--channel=*'
abort "Unknown release channel \""(echo "$argv[1]" | command cut -d= -f2)"\"."
abort "Unknown release channel \""(echo "$argv[1]" | command cut -d= -f2-)"\"."
case --check
set -g CHECK_ONLY
case '--config=*'
echo "$argv[1]" | command cut -d= -f2 | command sed -e "s#~#$HOME#" | read -g OMF_CONFIG
echo "$argv[1]" | command cut -d= -f2- | command sed -e "s#~#$HOME#" | read -g OMF_CONFIG
case --noninteractive
set -g NONINTERACTIVE
@ -70,10 +70,10 @@ Options:
case '--offline=*'
set -g OFFLINE
echo "$argv[1]" | command cut -d= -f2 | command sed -e "s#~#$HOME#" | read -g OFFLINE_PATH
echo "$argv[1]" | command cut -d= -f2- | command sed -e "s#~#$HOME#" | read -g OFFLINE_PATH
case '--path=*'
echo "$argv[1]" | command cut -d= -f2 | command sed -e "s#~#$HOME#" | read -g OMF_PATH
echo "$argv[1]" | command cut -d= -f2- | command sed -e "s#~#$HOME#" | read -g OMF_PATH
case --uninstall
set -g UNINSTALL
@ -225,7 +225,9 @@ function install_offline
if test -f "$OFFLINE_PATH"
say "Offline path is a file, assuming tar archive..."
command tar -xf "$OFFLINE_PATH" -C "$OMF_PATH"
mkdir -p "$OMF_PATH"
command tar -xf "$OFFLINE_PATH" -C "$OMF_PATH" --strip-components=1
or abort "Could not extract tar file $OFFLINE_PATH"
return

@ -1 +1 @@
bb1f4025934600ea6feef2ec11660e17e2b6449c5a23c033860aed712ad328c9 install
429a76e5b5e692c921aa03456a41258b614374426f959535167222a28b676201 install

@ -120,6 +120,7 @@ Inside this hook, you can access two package-related variables:
Packages can use this hook to clean up custom resources, etc.
> Note: for backwards-compatibility, uninstall hooks will also be run if they are located at `uninstall.fish` in the package root.
> Hooks may also be triggered by listening for the event `{$package}_uninstall` or `uninstall_$package`.
# Make it public

@ -1,5 +1,4 @@
<img src="https://cdn.rawgit.com/oh-my-fish/oh-my-fish/e4f1c2e0219a17e2c748b824004c8d0b38055c16/docs/logo.svg" align="left" width="128px" height="128px"/>
<img align="left" width="0" height="128px"/>
# Core Library
@ -54,4 +53,4 @@ To erase paths from autoload:
autoload -e $mypath $mypath/completions
```
[autoloading]: http://fishshell.com/docs/current/index.html#syntax-function-autoloading
[autoloading]: http://fishshell.com/docs/current/index.html#syntax-function-autoloading

@ -17,9 +17,16 @@ function omf.bundle.install
test -n "$name_or_url"; or continue
set name (omf.packages.name $name_or_url)
if not contains $name $packages
omf.packages.install $name_or_url;
and begin
test $type = package
and begin
require $name
or echo "Failed to require package: $name"
end
or true
end
or set error
end
end

@ -14,8 +14,11 @@ function omf.cli.install
and require $package
# If package is a theme, set it to active.
if contains -- $package (omf.packages.list --theme)
set -l themes (omf.packages.list --theme)
if contains -- $package $themes
omf.theme.set $package
else if set -l ind (contains -i -- (omf.packages.name $package) $themes)
omf.theme.set $themes[$ind]
end
test $status != 0;

@ -21,7 +21,7 @@ function omf.cli.theme -a name
end
case '*'
echo (omf::err)"Invalid number of arguments"(omf::off) >&2
echo "Usage: $_ "(omf::em)"$argv[1]"(omf::off)" [<theme name>]" >&2
echo "Usage: $_ "(omf::em)"t"(omf::off)"heme [<theme name>]" >&2
return $OMF_INVALID_ARG
end
end

@ -45,6 +45,52 @@ function __omf.doctor.git_version
end
end
function __omf.doctor.remote_match_db -a pkg_path
if test -z "$pkg_path"
# No package specified, run test for all packages
omf.index.update
set -l check_result 0
for pkg_path in $OMF_PATH/{themes,pkg}/*
__omf.doctor.remote_match_db $pkg_path
set check_result (math $check_result + $status)
end
return $check_result
end
# Check if the package remote matches the package repository
set -l path_parts
begin
set -l IFS '/'
echo $pkg_path | read -a path_parts
end
set -l pkg_name $path_parts[-1]
set -l index_uri (omf.index.stat $pkg_name repository)
or begin
# Built-in 'omf' and 'fish-spec' are exempt from this check
contains -- $pkg_name omf fish-spec; and return 0
echo (omf::err)"Warning:"(omf::off) "No index entry for "(omf::em)$pkg_name(omf::off)"."
echo
return 1
end
set -l repo_uri (omf.repo.remote_uri "$pkg_path")
set -l db_canonical (omf.repo.uri_components $index_uri)
set -l repo_canonical (omf.repo.uri_components $repo_uri)
if test "$db_canonical" != "$repo_canonical"
echo (omf::err)"Warning:"(omf::off) "The remote URI for "(omf::em)"$pkg_name"(omf::off)" doesn't match the URI in OMF's database."
echo "Remote URI:" $repo_uri
echo "Index URI:" $index_uri
echo
return 1
end
return 0
end
function omf.doctor
echo "Oh My Fish version: "(omf.version)
echo "OS type: "(uname)
@ -55,6 +101,7 @@ function omf.doctor
__omf.doctor.fish_version; or set -l doctor_failed
__omf.doctor.git_version; or set -l doctor_failed
__omf.doctor.theme; or set -l doctor_failed
__omf.doctor.remote_match_db; or set -l doctor_failed
fish "$OMF_PATH/bin/install" --check
or set -l doctor_failed

@ -18,8 +18,12 @@ function omf.packages.install -a name_or_url
set branch $props[3]
else
set name (omf.packages.name $name_or_url)
set url $name_or_url
set branch ""
if string match -qi -r "^[a-z\d-]+/[a-z\d\-\._]+\$" $name_or_url
set url "https://github.com/$name_or_url"
else
set url $name_or_url
end
end
if contains -- $name (omf.packages.list)

@ -1,3 +1,3 @@
function omf.packages.name -a name_or_url
command basename $name_or_url | sed -E 's/^(omf-)?((plugin|pkg|theme)-)?//;s/.git$//'
command basename $name_or_url | sed -E 's/^(omf-)?((plugin|pkg|theme)-)?//;s/\\.git$//'
end

@ -17,8 +17,11 @@ function omf.packages.remove -a pkg
# Run uninstall hook first.
omf.packages.run_hook $path uninstall
source $path/uninstall.fish 2> /dev/null;
and emit uninstall_$pkg
if test -f $path/uninstall.fish
source $path/uninstall.fish 2> /dev/null
end
emit uninstall_$pkg
emit {$pkg}_uninstall
if command rm -rf $path
omf.bundle.remove "package" $pkg

@ -1,12 +1,12 @@
function omf.repo.pull -a repo_dir branch
if test -z "$branch"
set branch "master"
end
function __omf.repo.git -V repo_dir
command git -C "$repo_dir" $argv
end
if test -z "$branch"
set branch (__omf.repo.git symbolic-ref -q --short HEAD)
end
set -l remote origin
if test (__omf.repo.git config --get remote.upstream.url)
set remote upstream

@ -0,0 +1,13 @@
function omf.repo.remote_uri -a repo_dir -a branch
test -z "$repo_dir"; and set repo_dir "$PWD"
set -l git_dir (command git -C "$repo_dir" rev-parse --show-toplevel 2>/dev/null)
and test "$git_dir" = "$repo_dir"
or return 1
test -z "$branch"; and set branch 'master'
set -l remote (command git -C "$repo_dir" config --get branch."$branch".remote)
or set -l remote origin
command git -C "$repo_dir" config --get remote."$remote".url
end

@ -0,0 +1,23 @@
function omf.repo.uri_components -a uri
test -n "$uri"
or return 1
switch $uri
case 'git@*'
echo $uri | sed -r 's/git@([^:]+):([^/]+)\/([^.]+).*/\1 \2 \3/g'
case 'http*://*'
echo $uri | sed -r 's/https?:\/\/([^:/]+)(:\d+)?\/([^/]+)\/([^./]+).*/\1 \3 \4/g'
case 'ftp*://*'
echo $uri | sed -r 's/ftps?:\/\/([^:/]+)(:\d+)?\/([^/]+)\/([^./]+).*/\1 \3 \4/g'
case 'ssh://*'
echo $uri | sed -r 's/ssh:\/\/([^@]+@)?([^:/]+)(:\d+)?\/([^/]+)\/([^./]+).*/\2 \4 \5/g'
case 'git://*'
echo $uri | sed -r 's/git:\/\/([^:/]+)(:\d+)?\/([^/]+)\/([^./]+).*/\1 \3 \4/g'
case '*@*'
echo $uri | sed -r 's/([^@]+@)?([^:]+):([^/]+)\/([^./]+).*/\2 \3 \4/g'
case '*'
echo $uri
return 1
end
return 0
end

@ -0,0 +1,77 @@
function describe_omf_packages_tests
function before_all
set -gx CI WORKAROUND
end
function it_can_extract_name_from_name
set -l output (omf.packages.name foo)
assert 0 = $status
assert "foo" = "$output"
end
function it_can_extract_name_of_a_plugin_package
set -l output (omf.packages.name plugin-foo)
assert 0 = $status
assert "foo" = "$output"
end
function it_can_extract_name_of_a_theme_package
set -l output (omf.packages.name theme-foo)
assert 0 = $status
assert "foo" = "$output"
end
function it_can_extract_name_from_name_ended_in_dot_git
set -l output (omf.packages.name foo.git)
assert 0 = $status
assert "foo" = "$output"
end
function it_can_extract_name_from_name_with_dot
set -l output (omf.packages.name foo.bar)
assert 0 = $status
assert "foo.bar" = "$output"
end
function it_can_extract_name_from_name_ended_in_git
set -l output (omf.packages.name foobargit)
assert 0 = $status
assert "foobargit" = "$output"
end
function it_can_extract_name_from_url
set -l output (omf.packages.name http://github.com/user/foo)
assert 0 = $status
assert "foo" = "$output"
end
function it_can_extract_name_from_url_of_a_plugin_package
set -l output (omf.packages.name http://github.com/user/plugin-foo)
assert 0 = $status
assert "foo" = "$output"
end
function it_can_extract_name_from_url_of_a_theme_package
set -l output (omf.packages.name http://github.com/user/theme-foo)
assert 0 = $status
assert "foo" = "$output"
end
function it_can_extract_name_from_url_ended_in_dot_git
set -l output (omf.packages.name http://github.com/user/foo.git)
assert 0 = $status
assert "foo" = "$output"
end
function it_can_extract_name_from_url_with_dot
set -l output (omf.packages.name http://github.com/user/foo.bar)
assert 0 = $status
assert "foo.bar" = "$output"
end
function it_can_extract_name_from_url_ended_in_git
set -l output (omf.packages.name http://github.com/user/foobargit)
assert 0 = $status
assert "foobargit" = "$output"
end
end
Loading…
Cancel
Save