feat: CI, readme

This commit is contained in:
Pavel Korytov 2022-02-12 22:12:30 +03:00
parent 6975628ebb
commit 9d34d0ce23
3 changed files with 132 additions and 17 deletions

30
.github/workflows/melpazoid.yml vendored Normal file
View file

@ -0,0 +1,30 @@
# melpazoid <https://github.com/riscy/melpazoid> build checks.
# If your package is on GitHub, enable melpazoid's checks by copying this file
# to .github/workflows/melpazoid.yml and modifying RECIPE and EXIST_OK below.
name: melpazoid
on: [push, pull_request]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python 3.6
uses: actions/setup-python@v1
with: { python-version: 3.6 }
- name: Install
run: |
python -m pip install --upgrade pip
sudo apt-get install emacs && emacs --version
git clone https://github.com/riscy/melpazoid.git ~/melpazoid
pip install ~/melpazoid
- name: Run
env:
LOCAL_REPO: ${{ github.workspace }}
# RECIPE is your recipe as written for MELPA:
RECIPE: (ivy-pass :repo "SqrtMinusOne/ivy-pass" :fetcher github)
# set this to false (or remove it) if the package isn't on MELPA:
EXIST_OK: false
run: echo $GITHUB_REF && make -C ~/melpazoid

68
README.org Normal file
View file

@ -0,0 +1,68 @@
#+TITLE: ivy-pass
A [[https://www.passwordstore.org/][pass]] frontend based on [[https://github.com/abo-abo/swiper#ivy][Ivy]], made primarily to use with [[https://github.com/ch11ng/exwm][EXWM]] and [[https://github.com/tumashu/ivy-posframe][ivy-posframe]].
Also take a look at Nicolas Petton's [[https://github.com/NicolasPetton/pass][pass]], =ivy-pass= is designed as complementary to the Nicolas' package.
This package is made with Ivy because I need some fine-tuning like actions and turning off the sort in some completions, and Ivy happens to be the competing system I'm using now.
* Installation
As the package isnt yet available anywhere but in this repository, you can clone the repository, add it to the load-path and require the package. My preferred way is =use-package= with =straight=:
#+begin_src emacs-lisp
(use-package ivy-pass
:straight (:host github :repo "SqrtMinusOne/ivy-pass")
:after (exwm))
#+end_src
This package types stuff with =xdotool=, so you need to have that available in your =$PATH=.
* Usage
Emacs' built-in [[https://www.gnu.org/software/emacs/manual/html_node/auth/The-Unix-password-store.html][password store]] integration has to be set up.
The only command is =M-x ivy-pass=, which invokes Ivy to select an entry from the pass database. Available commands in the selection buffer:
- =M-a=. Perform autotype
- =M-p=. Type password
- =M-u=. Type username
- =M-U=. Type url
- =M-f=. Select a field to type
* Customization
There are a few parameters that control delays:
- =ivy-pass-initial-wait= controls the initial delay before starting to type a sequence (in milliseconds)
- =ivy-pass-delay= controls the delay between typing characters (in milliseconds)
There is also =ivy-pass-sequences= that determines the sequence of actions =ivy-pass= performs.
It is an alist with the following required keys (corresponding to the basic actions):
- =autotype=
- =password=
- =username=
- =url=
The values are lists of the following elements:
- =wait=. Wait for =ivy-pass-initial-wait= milliseconds
- =(wait <milliseconds>)=. Wait for =<milliseconds>=.
- =(key <key>)=. Type =<key>=.
- =(field <field>)=. Type =<field>= of entry.
For example, the starting values:
#+begin_src emacs-lisp
'((autotype . (wait
(field . "username")
(key . "Tab")
(field . secret)
(key . "Return")))
(password . (wait (field . secret)))
(username . (wait (field . "username")))
(url . (wait (field . "url"))))
#+end_src
In addition to the global override, sequences can be overriden per-entry with a field called =sequence-<name>=, where =<name>= is a key of =ivy-pass-sequences=.
For example, here is an override to press =Tab= twice:
#+begin_example
<pass>
username: thexcloud@gmail.com
url: <url>
sequence-autotype: (wait (field . "username") (key . "Tab") (key . "Tab") (field . secret) (key . "Return"))
#+end_example

View file

@ -25,9 +25,18 @@
;;; Commentary:
;; A pass frontend based on Ivy, made primarily to use with EXWM.
;; A pass frontend based on Ivy, made primarily to use with EXWM and
;; ivy-posframe.
;;
;; The only command is `ivy-pass'.
;; This package types stuff with xdotool, so you need to have that
;; available in your $PATH.
;;
;; The only command is `ivy-pass', which presents an Ivy buffer to
;; select some entry from the pass database. Take a look at its
;; docstring for mode detail.
;;
;; Also take a look at the package README at
;; <https://github.com/SqrtMinusOne/ivy-pass>.
;;; Code:
(require 'ivy)
@ -38,7 +47,7 @@
:group 'password-store)
(defcustom ivy-pass-initial-wait 250
"How much miliseconds to wait before typing characters."
"How much milliseconds to wait before typing characters."
:type 'integer
:group 'ivy-pass)
@ -55,12 +64,20 @@
(key . "Tab")
(field . secret)
(key . "Return")))
(password . ((field . secret)))
(username . ((field . "username")))
(url . ((field . "url"))))
(password . (wait (field . secret)))
(username . (wait (field . "username")))
(url . (wait (field . "url"))))
"Sequences to execute by `ivy-pass'.
Take a look at `ivy-pass--get-commands' for available fields."
It is an alist with the following required keys (corresponding to the
basic actions):
- autotype
- password
- username
- url
Values are lists of symbols that determine action. Take a look at
`ivy-pass--get-commands' for available options."
:group 'ivy-pass
:options '(autotype password username url)
:type '(alist :key-type (symbol :tag "Sequence name")
@ -69,9 +86,9 @@ Take a look at `ivy-pass--get-commands' for available fields."
(choice
(const :tag "Wait for `ivy-pass-initial-wait'" wait)
(cons
:tag "Wait for miliseconds"
(const :tag "Wait for miliseconds" wait)
(integer :tag "Number of miliseconds to wait"))
:tag "Wait for milliseconds"
(const :tag "Wait for milliseconds" wait)
(integer :tag "Number of milliseconds to wait"))
(cons
:tag "Enter a field"
(const :tag "Enter a field" field)
@ -122,11 +139,11 @@ Call CALLBACK when the last command is executed."
"| xdotool type --clearmodifiers --file - --delay "
(number-to-string ivy-pass-delay)))
(defun ivy-pass--get-wait-command (&optional miliseconds)
"Return a command to sleep for MILISECONDS.
(defun ivy-pass--get-wait-command (&optional milliseconds)
"Return a command to sleep for MILLISECONDS.
If MILISECONDS is nil, default to `ivy-pass-initial-wait'."
(format "sleep %f" (/ (float (or miliseconds ivy-pass-initial-wait)) 1000)))
If MILLISECONDS is nil, default to `ivy-pass-initial-wait'."
(format "sleep %f" (/ (float (or milliseconds ivy-pass-initial-wait)) 1000)))
(defun ivy-pass--get-key-command (key)
"Get a command that presses KEY."
@ -143,9 +160,9 @@ ENTRY is an alist, FIELD is a symbol or string that can be a key of alist"
"Get a list of commands to execute for ENTRY.
SEQUENCE is a list of the following elements:
- `wait'. Wait for `ivy-pass-initial-wait' miliseconds.
- `(wait <miliseconds>)'. Wait for <miliseconds>.
- `(key <key>)'. Type <key>
- `wait'. Wait for `ivy-pass-initial-wait' milliseconds.
- `(wait <milliseconds>)'. Wait for <milliseconds>.
- `(key <key>)'. Type <key>.
- `(field <field>)'. Type <field> of entry."
(seq-filter
(lambda (command) (not (seq-empty-p command)))