gity 0.1.5 → 0.1.6

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: 76b2a42e4e87cd93fb6577c5925fbc7c9853951b2526154748b93e7de3a7ae65
4
- data.tar.gz: df5cbc7f0ccfa5bb1fa74874de83b7fc2ac80f21457917394fc1e3a2fbb8ed24
3
+ metadata.gz: 15e5211c909c15e0ca13dc9ce10a06f5ffcdd42583dc4164232f32b823bbe140
4
+ data.tar.gz: 637dab17aa26d859ff9b53e3048790a217fc1d668008747ced4e20c6d2284d92
5
5
  SHA512:
6
- metadata.gz: f84ff37f37b4b4d2df541e4f46b69c01a7069ae6ca0291c743c7983200317c9d0c9cfd3ff449db786090e191af0f8cb0d1c28dca15aa3a42a1845187f01ee6c8
7
- data.tar.gz: 293c22d0d2613a2c01de040cad6693f0507feb3186c1cd5ebae079427533c78321c043d22c0476f646fbb68caca4ef8bea534bd7a39faac3e37fe07bbf4e2cc1
6
+ metadata.gz: 514447320f368f96478e494a769dc12e0c77709d2d84a4613a3a489b900a503ec50e55f063e9404b9db7d926cbe704644aff878aac48b447aa333e12918b960c
7
+ data.tar.gz: 6adaa2ed6281fd130f96ace2a6065874dcf67a11205d00e5f7d3bf3684ca2ab5fa60cfd62a144bc10b27c059a137a3cab0b752abaaf54501bfd10428773fa09a
data/lib/gity/common.rb CHANGED
@@ -25,6 +25,15 @@ module Gity
25
25
  opts.each do |f|
26
26
  res = _pastel.send(f, res)
27
27
  end
28
+ elsif msg.is_a?(GitCli::Delta::VCSItem)
29
+ case msg
30
+ when GitCli::Delta::ModifiedFile, GitCli::Delta::ModifiedDir
31
+ res = _pastel.bright_yellow(res)
32
+ when GitCli::Delta::DeletedFile, GitCli::Delta::DeletedDir
33
+ res = _pastel.strikethrough(res)
34
+ when GitCli::Delta::StagedFile, GitCli::Delta::StagedDir
35
+ res = _pastel.on_yellow(res)
36
+ end
28
37
  end
29
38
 
30
39
  " #{res}"
@@ -11,20 +11,35 @@ module Gity
11
11
  _prmt.puts
12
12
  print_workspace_items(ws, files, skip_other_files: true)
13
13
  _prmt.puts
14
- efiles = files.modified[:files] + files.new[:files] + files.deleted[:files]
14
+ efiles = files.modified[:files] + files.deleted[:files]
15
+ efiles2 = files.new[:files] + files.new[:dirs]
15
16
 
16
17
  begin
17
18
  sels = _prmt.multi_select(_fmt("Please select all files to add to staging : "), filter: true, per_page: 10) do |m|
18
- m.choice "All", "."
19
+ m.choice _fmt("All"), "."
19
20
  efiles.sort.each do |f|
20
- m.choice f,f.path
21
+ m.choice _fmt(f),f.path
21
22
  end
23
+
24
+ efiles2.sort.each do |f|
25
+ if f.is_a?(GitCli::Delta::NewDir)
26
+ m.choice _fmt(f),f.path if f.has_files?
27
+ else
28
+ m.choice _fmt(f),f.path
29
+ end
30
+ end
31
+
32
+ m.choice "Done", :done
22
33
  end
23
34
 
24
- block.call(:before_add_to_staging, sels) if block
25
- st, res = ws.add_to_staging(*sels)
26
- block.call(:after_add_to_staging, st, res) if block
27
- raise OperationError, "Add to staging failed with error : #{res}" if not st
35
+ if sels.length == 0 or (sels.length == 1 and sels.first == :done)
36
+ # user not selected any files
37
+ else
38
+ block.call(:before_add_to_staging, sels) if block
39
+ st, res = ws.add_to_staging(*sels)
40
+ block.call(:after_add_to_staging, st, res) if block
41
+ raise OperationError, "Add to staging failed with error : #{res}" if not st
42
+ end
28
43
 
29
44
  rescue TTY::Reader::InputInterrupt
30
45
  end
@@ -18,12 +18,22 @@ module Gity
18
18
  _prmt.puts
19
19
  print_workspace_items(ws, files, skip_other_files: true)
20
20
  _prmt.puts
21
- efiles = files.modified[:files] + files.modified[:dirs] + files.new[:files] + files.new[:dirs] + files.deleted[:files] + files.deleted[:dirs]
21
+ efiles = files.modified[:files] + files.modified[:dirs] + files.deleted[:files] + files.deleted[:dirs]
22
+ efiles2 = files.new[:files] + files.new[:dirs]
22
23
 
23
24
  begin
24
25
  sels = _prmt.multi_select(_fmt("Please select all files to be committed in this session : "), filter: true, per_page: 10) do |m|
25
26
  efiles.sort.each do |f|
26
- m.choice f,f.path
27
+ m.choice _fmt(f),f.path
28
+ end
29
+
30
+ efiles2.sort.each do |f|
31
+ case f
32
+ when GitCli::Delta::NewDir
33
+ m.choice _fmt(f),f.path if f.has_files?
34
+ else
35
+ m.choice _fmt(f),f.path
36
+ end
27
37
  end
28
38
 
29
39
  # allow to exit without selecting any files
@@ -11,15 +11,23 @@ module Gity
11
11
  _prmt.puts
12
12
  print_workspace_items(ws, files, skip_other_files: true)
13
13
  _prmt.puts
14
- efiles = files.modified[:files] + files.new[:files] + files.staged[:files]
14
+ efiles = files.modified[:files] + files.staged[:files]
15
15
 
16
16
  begin
17
17
  sels = _prmt.multi_select(_fmt("Please select all applicable files to be deleted : "), filter: true, per_page: 10) do |m|
18
18
  efiles.sort.each do |f|
19
- m.choice f,f
19
+ m.choice _fmt(f),f
20
20
  end
21
+
22
+ files.new[:files].each do |f|
23
+ m.choice _fmt(f),f
24
+ end
25
+
26
+ m.choice "Done", :done
21
27
  end
22
28
 
29
+ sels.delete_if { |e| e == :done }
30
+
23
31
  sels.each do |s|
24
32
 
25
33
  if s.is_a?(GitCli::Delta::NewFile)
@@ -11,23 +11,29 @@ module Gity
11
11
  _prmt.puts
12
12
  print_workspace_items(ws, files, skip_other_files: true)
13
13
  _prmt.puts
14
- efiles = files.modified[:files] + files.staged[:files] + files.deleted[:files]
14
+ efiles = files.modified[:files] + files.staged[:files] #+ files.deleted[:files]
15
15
 
16
16
  begin
17
17
  sel = _prmt.select(_fmt("Please select file to diff : "), filter: true, per_page: 10) do |m|
18
18
  efiles.sort.each do |f|
19
19
  m.choice f,f.path
20
20
  end
21
+
22
+ m.choice "Done", :done
21
23
  end
22
24
 
23
- st, res = ws.diff_file(sel)
24
- raise OperationError, "Diff file '#{sel}' failed with error : #{res}" if not st
25
+ if is_empty?(sel) or sel != :done
25
26
 
26
- _prmt.puts _fmt "Diff file result for '#{sel}'"
27
- _prmt.puts _fmt res, :bright_blue
28
- _prmt.puts
29
- _prmt.puts _fmt "[Enter to close]", :inverse
30
- STDIN.gets
27
+ st, res = ws.diff_file(sel)
28
+ raise OperationError, "Diff file '#{sel}' failed with error : #{res}" if not st
29
+
30
+ _prmt.puts _fmt "Diff file result for '#{sel}'"
31
+ _prmt.puts _fmt res, :bright_blue
32
+ _prmt.puts
33
+ _prmt.puts _fmt "[Enter to close]", :inverse
34
+ STDIN.gets
35
+
36
+ end
31
37
 
32
38
  rescue TTY::Reader::InputInterrupt
33
39
  end
@@ -18,12 +18,16 @@ module Gity
18
18
  efiles.sort.each do |f|
19
19
  m.choice f,f.path
20
20
  end
21
+
22
+ m.choice "Done", :done
21
23
  end
22
24
 
23
- block.call(:before_ignore_file, sels) if block
24
- st, res = ws.ignore(*sels)
25
- block.call(:after_ignore_file, sels) if block
26
- raise OperationError, "Ignore operation failed with error : #{res}" if not st
25
+ if sels.length > 0 or (sels.length == 1 and sels.first != :done)
26
+ block.call(:before_ignore_file, sels) if block
27
+ st, res = ws.ignore(*sels)
28
+ block.call(:after_ignore_file, sels) if block
29
+ raise OperationError, "Ignore operation failed with error : #{res}" if not st
30
+ end
27
31
  rescue TTY::Reader::InputInterrupt
28
32
  end
29
33
 
@@ -29,9 +29,9 @@ module Gity
29
29
  defOps.each do |o|
30
30
  case o
31
31
  when :commit_all
32
- selOpts["Commit all"] = o if files.has_staged? or files.has_modified? or files.has_deleted?
32
+ selOpts["Commit all modified and deleted files"] = o if files.has_staged? or files.has_modified? or files.has_deleted?
33
33
  when :commit
34
- selOpts["Commit"] = o if files.has_staged? or files.has_new? or files.has_modified?
34
+ selOpts["Add and commit"] = o if files.has_staged? or files.has_new? or files.has_modified?
35
35
  when :add
36
36
  selOpts["Add"] = o if files.has_new?
37
37
  when :ignore
data/lib/gity/overview.rb CHANGED
@@ -38,7 +38,7 @@ module Gity
38
38
  files = mfiles.staged[:dirs] + mfiles.staged[:files]
39
39
  if files.length > 0
40
40
  files.sort.each do |v|
41
- _prmt.puts _fmt("* #{v}", :on_yellow)
41
+ _prmt.puts _fmt("* #{v}")
42
42
  end
43
43
  else
44
44
  _prmt.puts _fmt "** No staged file found", :yellow
@@ -50,17 +50,27 @@ module Gity
50
50
 
51
51
  _prmt.puts ""
52
52
  _prmt.puts _fmt "Other Files : ", :bold, :underline
53
- res = mfiles.modified[:dirs].sort + mfiles.modified[:files].sort + mfiles.deleted[:dirs].sort + mfiles.deleted[:files].sort + mfiles.new[:dirs].sort + mfiles.new[:files].sort
53
+ #res = mfiles.modified[:dirs].sort + mfiles.modified[:files].sort + mfiles.deleted[:dirs].sort + mfiles.deleted[:files].sort + mfiles.new[:dirs].sort + mfiles.new[:files].sort
54
+ res = mfiles.modified[:dirs] + mfiles.modified[:files] + mfiles.deleted[:dirs] + mfiles.deleted[:files]
55
+ res2 = mfiles.new[:dirs] + mfiles.new[:files]
54
56
 
55
- if res.length > 0
56
- res.each do |vv|
57
+ if res.length > 0 or res2.length > 0
58
+ res.sort.each do |vv|
59
+ case vv
60
+ when GitCli::Delta::ModifiedFile, GitCli::Delta::ModifiedDir
61
+ _prmt.puts _fmt(vv)
62
+ when GitCli::Delta::DeletedFile, GitCli::Delta::DeletedDir
63
+ _prmt.puts _fmt(vv)
64
+ end
65
+ end
66
+
67
+ _prmt.puts "\n ******** Untracked Files & Directories ******** "
68
+ res2.sort.each do |vv|
57
69
  case vv
58
70
  when GitCli::Delta::NewFile
59
71
  _prmt.puts _fmt(vv)
60
- when GitCli::Delta::ModifiedFile
61
- _prmt.puts _fmt(vv, :bright_yellow)
62
- when GitCli::Delta::DeletedFile
63
- _prmt.puts _fmt(vv, :strikethrough)
72
+ when GitCli::Delta::NewDir
73
+ _prmt.puts _fmt(vv) if vv.has_files?
64
74
  end
65
75
  end
66
76
 
data/lib/gity/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Gity
4
- VERSION = "0.1.5"
4
+ VERSION = "0.1.6"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gity
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.5
4
+ version: 0.1.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-10-23 00:00:00.000000000 Z
11
+ date: 2023-10-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: toolrack
@@ -86,14 +86,14 @@ dependencies:
86
86
  requirements:
87
87
  - - "~>"
88
88
  - !ruby/object:Gem::Version
89
- version: 0.13.8
89
+ version: 0.13.9
90
90
  type: :runtime
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
94
  - - "~>"
95
95
  - !ruby/object:Gem::Version
96
- version: 0.13.8
96
+ version: 0.13.9
97
97
  - !ruby/object:Gem::Dependency
98
98
  name: release-gem
99
99
  requirement: !ruby/object:Gem::Requirement