mirror of
https://github.com/jesseduffield/lazygit.git
synced 2026-09-10 15:46:26 -04:00
22 lines
314 B
Go
22 lines
314 B
Go
package stack
|
|
|
|
type Stack struct {
|
|
stack []string
|
|
}
|
|
|
|
func (s *Stack) Push(contextKey string) {
|
|
s.stack = append(s.stack, contextKey)
|
|
}
|
|
|
|
func (s *Stack) Pop() (string, bool) {
|
|
if len(s.stack) == 0 {
|
|
return "", false
|
|
}
|
|
|
|
n := len(s.stack) - 1
|
|
value := s.stack[n]
|
|
s.stack = s.stack[:n]
|
|
|
|
return value, true
|
|
}
|