Class: Gitt::Commands::Branch
- Inherits:
-
Object
- Object
- Gitt::Commands::Branch
- Defined in:
- lib/gitt/commands/branch.rb
Overview
A Git branch command wrapper.
Instance Method Summary collapse
- #call ⇒ Object
- #default(fallback = "main") ⇒ Object
-
#initialize(shell: SHELL) ⇒ Branch
constructor
A new instance of Branch.
- #name ⇒ Object
Constructor Details
Instance Method Details
#call ⇒ Object
22 |
# File 'lib/gitt/commands/branch.rb', line 22 def call(*) = shell.call("branch", *) |
#default(fallback = "main") ⇒ Object
15 16 17 18 19 20 |
# File 'lib/gitt/commands/branch.rb', line 15 def default fallback = "main" shell.call("config", "init.defaultBranch") .fmap(&:chomp) .fmap { |name| name.empty? ? fallback : name } .or(Success(fallback)) end |
#name ⇒ Object
24 |
# File 'lib/gitt/commands/branch.rb', line 24 def name = shell.call("rev-parse", "--abbrev-ref", "HEAD").fmap(&:chomp) |