dorian-top 0.1.0 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/bin/top +6 -5
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 532ba71144adb7c7f6efdaf770bf47561d52cd4259392d91fb57cc7da92b5ada
4
- data.tar.gz: 59720b5f25e6bd5936ab82353fe075e29bce398e92b5b4e2b2dd35f2eee1b38d
3
+ metadata.gz: 79229b911c817146536894a996c8fcd06ec5dfb9fe0076853f6237274968b596
4
+ data.tar.gz: '00691032225c23d31e1b7d875c97cac98c05a774cd60b14ae552294175dd5865'
5
5
  SHA512:
6
- metadata.gz: 4109a260b9cf1be18923bdc3ef3e6168f821071fcdfb12bb84ff10f1666f1ee7f451d4accddc0a8bccd218b9a6d6a82fbde675e508568361046e92be657f1c26
7
- data.tar.gz: 63e847864c5aadfc0e8a2799fb9a1aee259af177bd444ffdd50ae9c5bb580b5b644228a3176de05d4a90a7c7d8cfb2946e4cb90c61bd8bfa207f940c63ae52db
6
+ metadata.gz: 89a8105eb8fd6652186c03d2c800e9adaf4d41513525823c6d87b4088795db99056c37f878ff2003a1c0ef8bf0180b9290e22414b608ecc940f22dec7df856c4
7
+ data.tar.gz: 333e2ea33edb9f4d55d73da2d125b861740f7127c8c9757c119af5f3d433857b104782fd4a8d4ff8d87a2a10e15b4ec75da6415d9a35daa6f5393ca356370979
data/bin/top CHANGED
@@ -10,18 +10,19 @@ N = (ARGV.first || 10).to_i
10
10
  SHELL = File.basename(ARGV.last || ENV["SHELL"] || "bash")
11
11
 
12
12
  HISTORY =
13
- if SHELL == "fish"
13
+ case SHELL
14
+ when "fish"
14
15
  File
15
16
  .read("#{Dir.home}/.local/share/fish/fish_history")
16
17
  .lines
17
18
  .grep(/^- cmd: /)
18
19
  .map { |line| line.split("- cmd: ", 2).last.strip }
19
- elsif SHELL == "bash"
20
+ when "bash"
20
21
  File.read("#{Dir.home}/.bash_history").lines.map(&:strip)
21
- elsif SHELL == "zsh"
22
+ when "zsh"
22
23
  File.read("#{Dir.home}/.zsh_history").lines.map(&:strip)
23
24
  else
24
- raise NotImplementedError.new(SHELL)
25
+ raise NotImplementedError, SHELL
25
26
  end
26
27
 
27
28
  puts(
@@ -37,7 +38,7 @@ puts(
37
38
  "#{index + 1}\t" \
38
39
  "#{command_count}\t" \
39
40
  "#{(command_count * 100 / HISTORY.size.to_f).round(3)}%\t" \
40
- "#{command}"
41
+ "#{command}"
41
42
  end
42
43
  .first(N)
43
44
  )
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dorian-top
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dorian Marié
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-02-26 00:00:00.000000000 Z
11
+ date: 2024-04-03 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: |-
14
14
  Lists the most used commands