git_curate 0.7.5 → 0.8.0

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: 90d60b797ee454f3938bd46038a6c7e805f209af540bc46579a10abfbb1c428b
4
- data.tar.gz: 64752a180b3fe5f73977f7eb1a7d3382f3f2cd00c639d12e792d9689b6855bfe
3
+ metadata.gz: a28aa1f3d401c90e8955406bd6917d5669af3c21be54e548c23a46370254383d
4
+ data.tar.gz: c33041318700ca15a1f592e29ecee075f58776ce972b178c13fe90356cdbd560
5
5
  SHA512:
6
- metadata.gz: 3e51d0d5ee3ea6e9932f7ef35c4f5e5507f5cd47238edc6dc6107e08c3c3a7b611cfe5e80445b2a2af5cc100f88a76c1de90bc45f408f41a09995805f555510e
7
- data.tar.gz: 19aee7094f8e682b165560c82931d3ae72ce28d399221dc464795846d91fb8b0e0e991268d0b57f678aee9833d32a69ce16e74ce25b09d3bd725cbce612d1cb1
6
+ metadata.gz: 3539fde73f294610c797ab422b6503d893b74af254a2fc524ee8d338341b953a4775c179875c146ae3942f08dd2c606eae547d328b6aaa3363f5f1122e32ce20
7
+ data.tar.gz: ecd19b5b368d86911627176f84ad4f06bfffe921813a07bd42554a08bb2411a12d6e93b4fba3a65072208972f7a299d4a34791dfb748f2cfd14ee77eba0c43d4
data/CHANGELOG.md CHANGED
@@ -1,5 +1,14 @@
1
1
  # Changelog
2
2
 
3
+ ### v0.8.0
4
+
5
+ * Change options to make them more memorable/obvious
6
+ * Always print options legend at top, if in interactive mode
7
+ * Add a column showing last commit hash
8
+ * Tweak column header layout
9
+ * Fix warnings on Ruby 2.7
10
+ * Fix minor error in README
11
+
3
12
  ### v0.7.5
4
13
 
5
14
  * Drop support for Ruby 2.1
data/README.md CHANGED
@@ -17,6 +17,7 @@ one at a time and _then_ running `git branch -D` in a separate step, is painful.
17
17
  a time, outputting the following information about each:
18
18
 
19
19
  * Last commit date
20
+ * Last commit hash
20
21
  * Last commit author
21
22
  * Last commit subject
22
23
  * Whether the branch has been merged into the current HEAD
@@ -49,18 +50,18 @@ git curate
49
50
  This will step you through your local branches one at a time, outputting some information about
50
51
  each, and asking you whether to keep or delete each branch.
51
52
 
52
- At each branch, enter "n"—or simply press Enter—to _keep_ the branch and move to the next one;
53
- or enter "y" to select the branch for deletion.
53
+ At each branch, enter "k"—or simply press Enter—to _keep_ the branch and move to the next one;
54
+ or enter "d" to select the branch for deletion.
54
55
 
55
- Entering "done" will conclude the session immediately, deleting all selected branches; and "abort" will
56
- end the session without deleting any branches. Once the final branch has been considered,
56
+ Entering "e" will end the session immediately, deleting all selected branches; and "a" will
57
+ abort the session without deleting any branches. Once the final branch has been considered,
57
58
  any selected branches will be immediately deleted.
58
59
 
59
60
  Note the branch you are currently on will not be included in the list, as `git` does not allow you to delete
60
61
  the branch you're on.
61
62
 
62
63
  If you just want to view the information about your local branches without stepping through
63
- them interactively, enter `git branch --list` or `git branch -l`. Your current branch _will_
64
+ them interactively, enter `git curate --list` or `git curate -l`. Your current branch _will_
64
65
  be included in this list in this case.
65
66
 
66
67
  ## Contributing
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.7.5
1
+ 0.8.0
data/assets/demo.gif CHANGED
Binary file
data/git_curate.gemspec CHANGED
@@ -29,7 +29,7 @@ Gem::Specification.new do |spec|
29
29
  spec.require_paths = ["lib"]
30
30
 
31
31
  spec.add_runtime_dependency "highline", "2.0.3"
32
- spec.add_runtime_dependency "tabulo", "2.4.0"
32
+ spec.add_runtime_dependency "tabulo", "2.4.1"
33
33
  spec.add_runtime_dependency "tty-screen", "0.7.1"
34
34
 
35
35
  spec.add_development_dependency "bundler"
@@ -50,6 +50,11 @@ module GitCurate
50
50
  @last_commit_date
51
51
  end
52
52
 
53
+ def hash
54
+ initialize_last_commit_data
55
+ @hash
56
+ end
57
+
53
58
  def last_author
54
59
  initialize_last_commit_data
55
60
  @last_author
@@ -109,10 +114,10 @@ module GitCurate
109
114
 
110
115
  # For Windows compatibility we need double quotes around the format string, as well as spaces
111
116
  # between the placeholders.
112
- command = %Q(git log -n1 --date=short --format=format:"%cd %n %an %n %s" #{proper_name} --)
117
+ command = %Q(git log -n1 --date=short --format=format:"%cd %n %h %n %an %n %s" #{proper_name} --)
113
118
  @last_commit_data = Util.command_to_a(command)
114
119
 
115
- @last_commit_date, @last_author, @last_subject = @last_commit_data
120
+ @last_commit_date, @hash, @last_author, @last_subject = @last_commit_data
116
121
  end
117
122
 
118
123
  end
@@ -26,21 +26,27 @@ module GitCurate
26
26
  return EXIT_FAILURE
27
27
  end
28
28
 
29
+ if interactive?
30
+ puts
31
+ print_help
32
+ puts
33
+ end
34
+
29
35
  branches = Branch.local
30
36
  branches.reject!(&:current?) if interactive?
31
37
 
32
38
  table = Tabulo::Table.new(branches, border: :reduced_ascii, column_padding: 0, align_header: :left) do |t|
33
39
  t.add_column(:branch, header: "Branch") { |b| b.displayable_name(pad: !interactive?) }
34
- t.add_column("Last commit", &:last_commit_date)
35
- t.add_column("Last author", &:last_author)
36
- t.add_column("Last subject", &:last_subject)
40
+ t.add_column("Last commit:#{$/}Date", &:last_commit_date)
41
+ t.add_column("#{$/}Hash", &:hash)
42
+ t.add_column("#{$/}Author", &:last_author)
43
+ t.add_column("#{$/}Subject", &:last_subject)
37
44
  t.add_column("Merged#{$/}into HEAD?") { |b| b.merged? ? "Merged" : "Not merged" }
38
45
  t.add_column("Status vs#{$/}upstream", &:upstream_info)
39
46
  end
40
47
 
41
- prompt = " Delete? [y/N/done/abort/help] "
42
- longest_response = "abort"
43
- prompt_and_response_width = (interactive? ? (prompt.length + longest_response.length + 1) : 0)
48
+ prompt = " d/[k]/e/a ? "
49
+ prompt_and_response_width = (interactive? ? (prompt.length + 2) : 0)
44
50
  max_table_width = TTY::Screen.width - prompt_and_response_width
45
51
  table.pack(max_table_width: max_table_width)
46
52
 
@@ -53,15 +59,15 @@ module GitCurate
53
59
 
54
60
  table.each_with_index do |row, index|
55
61
  case HighLine.ask("#{row} #{prompt}").downcase
56
- when "y"
62
+ when "d"
57
63
  branches_to_delete << row.source
58
- when "n", ""
64
+ when "k", ""
59
65
  ; # do nothing
60
- when "done"
66
+ when "e"
61
67
  puts table.horizontal_rule
62
68
  finalize(branches_to_delete)
63
69
  return EXIT_SUCCESS
64
- when "abort"
70
+ when "a"
65
71
  puts table.horizontal_rule
66
72
  puts "#{$/}Aborting. No branches deleted."
67
73
  return EXIT_SUCCESS
@@ -95,15 +101,19 @@ module GitCurate
95
101
  end
96
102
 
97
103
  def print_help
98
- puts <<-EOL
99
- Simply hit <Enter> to keep this branch and skip to the next one;
100
- or enter one of the following commands:
101
- y -- mark branch for deletion
102
- n -- keep branch (equivalent to just <Enter>)
103
- done -- delete selected branches and exit session
104
- abort -- abort without deleting any branches
105
- help -- print this help message
106
- EOL
104
+ instructions = [
105
+ ["d :", "delete branch"],
106
+ ["k / <enter> :", "keep branch"],
107
+ ["e :", "end session, deleting all selected branches"],
108
+ ["a :", "abort session, keeping all branches"],
109
+ ]
110
+ instructions_table = Tabulo::Table.new(instructions, border: :blank, header_frequency: nil,
111
+ column_padding: [1, 0]) do |t|
112
+
113
+ t.add_column(0, align_body: :right, &:first)
114
+ t.add_column(1, &:last)
115
+ end
116
+ puts instructions_table.pack
107
117
  end
108
118
 
109
119
  end
@@ -1,3 +1,3 @@
1
1
  module GitCurate
2
- VERSION = "0.7.5"
2
+ VERSION = "0.8.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: git_curate
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.5
4
+ version: 0.8.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matthew Harvey
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-04-03 00:00:00.000000000 Z
11
+ date: 2020-04-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: highline
@@ -30,14 +30,14 @@ dependencies:
30
30
  requirements:
31
31
  - - '='
32
32
  - !ruby/object:Gem::Version
33
- version: 2.4.0
33
+ version: 2.4.1
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - '='
39
39
  - !ruby/object:Gem::Version
40
- version: 2.4.0
40
+ version: 2.4.1
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: tty-screen
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -188,8 +188,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
188
188
  - !ruby/object:Gem::Version
189
189
  version: '0'
190
190
  requirements: []
191
- rubyforge_project:
192
- rubygems_version: 2.7.6
191
+ rubygems_version: 3.1.2
193
192
  signing_key:
194
193
  specification_version: 4
195
194
  summary: Simple git branch curation tool