agen 0.1.6 → 0.1.7

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f90fceac9fed45a59113e45eb28e8eef96f7552b487d4ccc90f037765bdd96d3
4
- data.tar.gz: 60e5528277c8cd195d43e67bf4653d70ddddb9cd93d1109c623e4d5ded9c546f
3
+ metadata.gz: 88c5c183242fa63c57940eba901e982778e930921fdaf8eda8ba2c64a23801f0
4
+ data.tar.gz: 262a494cd57ad6d3ee4474eee51a686a94309084222b5fc4b128be7ce35e5f40
5
5
  SHA512:
6
- metadata.gz: 138b4c4c646a0b62b1665c057fa5dd659c13643fe751c2909c281c9f5446ca23ab2c67a8c51dc967ba38fb43ef1b8f4017e7d019337cbe378f27bd2f89b7119b
7
- data.tar.gz: 43ad014f35c326d08f2c242680eaccd36e55a4bb14c316ab5cf8c6136fa82ed4956c15d3ab88d18670a2403e46f7f57aee103bb9c60ad111e83645e6d253a281
6
+ metadata.gz: d994611c28f6f086450a4baf40e842cff15108cedaeba542710827ec77499f41086bcc1f334866873c1f3ef167588885ede145de26afb60eb30f6644036ba0ca
7
+ data.tar.gz: d553d15e0420538459819547d86faa117244833080ad27dc35177d776a2e37a2996c047042acdd0aa5d426da02df1060e0413f9cc5c09590b24a9b3a50804f52
data/CHANGELOG.md CHANGED
@@ -1,5 +1,8 @@
1
1
  ## [Released]
2
2
 
3
+ ## [0.1.7] - 2021-04-26
4
+ - Fix: Ensures the same aliases is not built for multiple commands in the same run.
5
+
3
6
  ## [0.1.6] - 2021-04-25
4
7
  - Adds ability to specify number of aliases to generate.
5
8
 
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- agen (0.1.6)
4
+ agen (0.1.7)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
data/README.md CHANGED
@@ -6,8 +6,9 @@ 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. Use
10
- `agen -h` to see available options.
9
+ Install with `gem install agen` and then run `agen` to build your aliases. Then
10
+ be sure to `source ~/.zshrc` before using the new aliases. Use `agen -h` to see
11
+ available options.
11
12
 
12
13
  Right now, this will only work with `zsh`, but support for other shells is on
13
14
  the very lengthy todo list. By default, agen reads from `.zsh_history` and
data/exe/agen CHANGED
@@ -1,7 +1,5 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
- $LOAD_PATH.unshift("#{__dir__}/../lib")
4
-
5
3
  require "agen"
6
4
 
7
5
  Agen::CLI.new(ARGV).run
data/lib/agen/builder.rb CHANGED
@@ -8,18 +8,22 @@ module Agen
8
8
  end
9
9
 
10
10
  def aliases
11
+ aliases = []
11
12
  @commands.map do |cmd|
12
13
  aliaz = cmd.scan(/\b\w/).join
13
14
 
14
15
  # Is is possibly we could overwrite a command here still? Sure.
15
16
  # I will live with it for now.
16
- if command_already_exists?(aliaz)
17
+ if command_already_exists?(aliaz) || aliases.include?(aliaz)
17
18
  # We could improve to look more like the original command, but again, works for now.
18
19
  aliaz += aliaz[-1]
19
20
  end
20
21
 
21
22
  candidate = "alias #{aliaz}=\"#{cmd}\""
22
- candidate if alias_does_not_exist?(candidate)
23
+ if alias_does_not_exist?(candidate)
24
+ aliases << aliaz
25
+ candidate
26
+ end
23
27
  end.compact
24
28
  end
25
29
 
data/lib/agen/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Agen
4
- VERSION = "0.1.6"
4
+ VERSION = "0.1.7"
5
5
  end
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.6
4
+ version: 0.1.7
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-26 00:00:00.000000000 Z
11
+ date: 2021-04-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake