Skip to content

Commit

Permalink
port to python/posix, see #113
Browse files Browse the repository at this point in the history
  • Loading branch information
laktak committed May 8, 2024
1 parent 215b1ad commit ef41f12
Show file tree
Hide file tree
Showing 7 changed files with 476 additions and 549 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
run: |
curl -LsS -o ~/shfmt https://github.com/mvdan/sh/releases/download/v3.1.2/shfmt_v3.1.2_linux_amd64
chmod +x ~/shfmt
~/shfmt -d scripts/ extrakto.tmux
~/shfmt -p -d scripts/ extrakto.tmux
- name: tests
run: |
python3 -m unittest discover -s tests/
11 changes: 5 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,13 @@ Use it for paths, URLs, options from a man page, git hashes, docker container na
- [tmux](https://github.com/tmux/tmux) - popups require 3.2, otherwise extrakto will open in a split window.
- [fzf](https://github.com/junegunn/fzf)
- Python 3.6+
- Bash (tested with 5.0+, on macOS please `brew install bash` first)
see the [Wiki for Bash 4 support](https://github.com/laktak/extrakto/wiki/Bash4)
- a posix shell like Bash

Supported clipboards:

- Linux Xorg (xclip) and Wayland (wl-copy)
- macOS (pbcopy)
- WSL (aka "Bash on Windows")
- WSL
- *bring your own*, see the [Wiki](https://github.com/laktak/extrakto/wiki/) for examples (like termux)

## Installation with [Tmux Plugin Manager](https://github.com/tmux-plugins/tpm)
Expand Down Expand Up @@ -64,13 +63,13 @@ Add or look for special tips in our [wiki](https://github.com/laktak/extrakto/wi

## Options

To set any of these options write on your `~/.tmux.conf` file:
You can set any of these options by adding them to your `~/.tmux.conf` file:

```
set -g <option> "<value>"
```

Where `<option>` and `<value>` are one of the specified here below
Where `<option>` and `<value>` correspond to one of the options specified below

### Common Options

Expand Down Expand Up @@ -190,4 +189,4 @@ Thanks go to all contributors for their ideas and PRs!

**If you make a PR, please keep it small so that it's easier to test and review. Try to create one PR per feature/bug.**

Please run `black` if you change any python code and run `shfmt` if you change any bash files.
Please run `black` if you change any python code and run `shfmt -p` if you change any shell files.
20 changes: 13 additions & 7 deletions extrakto.tmux
Original file line number Diff line number Diff line change
@@ -1,12 +1,18 @@
#!/usr/bin/env bash
#!/bin/sh

CURRENT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
script_dir=$(dirname "$0")
script_dir=$(
cd "$script_dir"
pwd
)

source "$CURRENT_DIR/scripts/helpers.sh"
extrakto_open="$CURRENT_DIR/scripts/open.sh"
. "$script_dir/scripts/helpers.sh"

extrakto_key=$(get_option "@extrakto_key")
extrakto_open="$script_dir/scripts/open.sh"
extrakto_key=$(get_option "@extrakto_key" "tab")

if [[ $(echo $extrakto_key | tr [:upper:] [:lower:]) != none ]]; then
tmux bind-key ${extrakto_key} run-shell "\"$extrakto_open\" \"#{pane_id}\""
lowercase_key=$(echo $extrakto_key | tr '[:upper:]' '[:lower:]')

if [ "$lowercase_key" != "none" ]; then
tmux bind-key "${extrakto_key}" run-shell "\"$extrakto_open\" \"#{pane_id}\""
fi
Loading

0 comments on commit ef41f12

Please sign in to comment.