agen 0.1.5 → 0.1.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +3 -0
- data/Gemfile.lock +1 -1
- data/README.md +4 -3
- data/lib/agen/cli.rb +13 -2
- data/lib/agen/runner.rb +4 -2
- data/lib/agen/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f90fceac9fed45a59113e45eb28e8eef96f7552b487d4ccc90f037765bdd96d3
|
4
|
+
data.tar.gz: 60e5528277c8cd195d43e67bf4653d70ddddb9cd93d1109c623e4d5ded9c546f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 138b4c4c646a0b62b1665c057fa5dd659c13643fe751c2909c281c9f5446ca23ab2c67a8c51dc967ba38fb43ef1b8f4017e7d019337cbe378f27bd2f89b7119b
|
7
|
+
data.tar.gz: 43ad014f35c326d08f2c242680eaccd36e55a4bb14c316ab5cf8c6136fa82ed4956c15d3ab88d18670a2403e46f7f57aee103bb9c60ad111e83645e6d253a281
|
data/CHANGELOG.md
CHANGED
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -6,10 +6,12 @@ Generate shell aliases based on your most commonly entered commands.
|
|
6
6
|
|
7
7
|
## Installation & Usage
|
8
8
|
|
9
|
-
Install with `gem install agen` and then run `agen` to build your aliases.
|
9
|
+
Install with `gem install agen` and then run `agen` to build your aliases. Use
|
10
|
+
`agen -h` to see available options.
|
10
11
|
|
11
12
|
Right now, this will only work with `zsh`, but support for other shells is on
|
12
|
-
the very lengthy todo list.
|
13
|
+
the very lengthy todo list. By default, agen reads from `.zsh_history` and
|
14
|
+
writes to `.zshrc`.
|
13
15
|
|
14
16
|
## Development
|
15
17
|
|
@@ -23,7 +25,6 @@ Bug reports and pull requests are welcome on GitHub at https://github.com/Jonath
|
|
23
25
|
|
24
26
|
## Roadmap
|
25
27
|
|
26
|
-
* CLI will let you specify number of aliases you want to create.
|
27
28
|
* CLI will let you see proposed aliases and accept/decline them interactively.
|
28
29
|
OR, in "auto mode", commands will be added automatically (as in 1). Auto
|
29
30
|
should be default?
|
data/lib/agen/cli.rb
CHANGED
@@ -1,5 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
require "optparse"
|
4
|
+
|
3
5
|
module Agen
|
4
6
|
class CLI
|
5
7
|
def initialize(args = [])
|
@@ -7,8 +9,17 @@ module Agen
|
|
7
9
|
end
|
8
10
|
|
9
11
|
def run
|
10
|
-
|
11
|
-
|
12
|
+
options = {}
|
13
|
+
|
14
|
+
OptionParser.new do |opts|
|
15
|
+
opts.banner = "Usage: agen [options]"
|
16
|
+
|
17
|
+
opts.on("-nNUMBER", "--number=NUMBER", Integer, "Number of aliases to generate") do |n|
|
18
|
+
options[:number] = n
|
19
|
+
end
|
20
|
+
end.parse!
|
21
|
+
|
22
|
+
Runner.new(**options).run
|
12
23
|
end
|
13
24
|
end
|
14
25
|
end
|
data/lib/agen/runner.rb
CHANGED
@@ -4,16 +4,18 @@ module Agen
|
|
4
4
|
class Runner
|
5
5
|
DEFAULT_HISTFILE = "#{Dir.home}/.zsh_history"
|
6
6
|
DEFAULT_RCFILE = "#{Dir.home}/.zshrc"
|
7
|
+
DEFAULT_NUMBER = 5
|
7
8
|
|
8
9
|
attr_reader :histfile, :rcfile
|
9
10
|
|
10
|
-
def initialize(histfile: DEFAULT_HISTFILE, rcfile: DEFAULT_RCFILE)
|
11
|
+
def initialize(histfile: DEFAULT_HISTFILE, rcfile: DEFAULT_RCFILE, number: DEFAULT_NUMBER)
|
11
12
|
@histfile = histfile
|
12
13
|
@rcfile = rcfile
|
14
|
+
@number = number
|
13
15
|
end
|
14
16
|
|
15
17
|
def run
|
16
|
-
commands = Finder.new(histfile).commands
|
18
|
+
commands = Finder.new(histfile).commands(limit: @number)
|
17
19
|
aliases = Builder.new(commands, rcfile).aliases
|
18
20
|
|
19
21
|
File.open(rcfile, "a") do |file|
|
data/lib/agen/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: agen
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jonathan Thom
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-04-
|
11
|
+
date: 2021-04-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|