Skip to content

Commit bf198b2

Browse files
committed
but: updates from 0.17.6
1 parent 281eb92 commit bf198b2

File tree

7 files changed

+69
-4
lines changed

7 files changed

+69
-4
lines changed
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
package cmd
2+
3+
import (
4+
"github.com/carapace-sh/carapace"
5+
"github.com/carapace-sh/carapace-bin/pkg/actions/tools/but"
6+
"github.com/spf13/cobra"
7+
)
8+
9+
var absorbCmd = &cobra.Command{
10+
Use: "absorb",
11+
Short: "",
12+
Run: func(cmd *cobra.Command, args []string) {},
13+
}
14+
15+
func init() {
16+
carapace.Gen(absorbCmd).Standalone()
17+
18+
absorbCmd.Flags().BoolP("help", "h", false, "Print help")
19+
rootCmd.AddCommand(absorbCmd)
20+
21+
carapace.Gen(absorbCmd).PositionalCompletion(
22+
carapace.Batch(
23+
but.ActionLocalBranches(),
24+
// TODO change ids
25+
).ToA(),
26+
)
27+
}

completers/common/but_completer/cmd/forge_auth.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import (
77

88
var forge_authCmd = &cobra.Command{
99
Use: "auth",
10-
Short: "Authenticat with your forge provider (at the moment, only GitHub is supported)",
10+
Short: "Authenticate with your forge provider (at the moment, only GitHub is supported)",
1111
Run: func(cmd *cobra.Command, args []string) {},
1212
}
1313

completers/common/but_completer/cmd/forge_help_auth.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import (
77

88
var forge_help_authCmd = &cobra.Command{
99
Use: "auth",
10-
Short: "Authenticat with your forge provider (at the moment, only GitHub is supported)",
10+
Short: "Authenticate with your forge provider (at the moment, only GitHub is supported)",
1111
Run: func(cmd *cobra.Command, args []string) {},
1212
}
1313

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
package cmd
2+
3+
import (
4+
"github.com/carapace-sh/carapace"
5+
"github.com/spf13/cobra"
6+
)
7+
8+
var help_absorbCmd = &cobra.Command{
9+
Use: "absorb",
10+
Short: "",
11+
Run: func(cmd *cobra.Command, args []string) {},
12+
}
13+
14+
func init() {
15+
carapace.Gen(help_absorbCmd).Standalone()
16+
17+
helpCmd.AddCommand(help_absorbCmd)
18+
}

completers/common/but_completer/cmd/help_forge_auth.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import (
77

88
var help_forge_authCmd = &cobra.Command{
99
Use: "auth",
10-
Short: "Authenticat with your forge provider (at the moment, only GitHub is supported)",
10+
Short: "Authenticate with your forge provider (at the moment, only GitHub is supported)",
1111
Run: func(cmd *cobra.Command, args []string) {},
1212
}
1313

completers/common/but_completer/cmd/root.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ func init() {
3030

3131
rootCmd.Flags().StringP("current-dir", "C", "", "Run as if gitbutler-cli was started in PATH instead of the current working directory")
3232
rootCmd.Flags().BoolP("help", "h", false, "Print help")
33-
rootCmd.Flags().BoolP("json", "j", false, "Whether to use JSON output format")
33+
rootCmd.PersistentFlags().BoolP("json", "j", false, "Whether to use JSON output format")
3434

3535
carapace.Gen(rootCmd).FlagCompletion(carapace.ActionMap{
3636
"current-dir": carapace.ActionDirectories(),

pkg/actions/tools/but/hash.go

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
package but
2+
3+
// TODO
4+
//
5+
//lint:ignore U1000 wip
6+
func hash(input string) string {
7+
var hash uint64 = 0
8+
for i := 0; i < len(input); i++ {
9+
hash = hash*31 + uint64(input[i])
10+
}
11+
12+
firstChars := "ghijklmnopqrstuvwxyz"
13+
firstChar := string(firstChars[hash%20])
14+
hash /= 20
15+
16+
secondChars := "0123456789abcdefghijklmnopqrstuvwxyz"
17+
secondChar := string(secondChars[hash%36])
18+
19+
return firstChar + secondChar
20+
}

0 commit comments

Comments
 (0)