Skip to content

Commit 485be92

Browse files
committed
refactor(cmd): move commands to internal package
Both interactive and non-interactive commands now lives as separate structs inside internal/cmd. This change reduces the complexity of the cobra entry point and pave the way to introduce tests. Additional changes: renamed the gci prefix for internal imports from emilkje/cwc to intility/cwc to properly format the imports.
1 parent 2db41ca commit 485be92

12 files changed

+494
-427
lines changed

.cwc/templates.yaml

+20-1
Original file line numberDiff line numberDiff line change
@@ -34,4 +34,23 @@ templates:
3434
* Do not format the output with ``` blocks or other markdown features,
3535
only return the message title and body in plain text.
3636
37-
My job depends on your ability to follow these instructions, you can do this!
37+
My job depends on your ability to follow these instructions, you can do this!
38+
- name: refactor
39+
description: A template for refactoring code.
40+
systemMessage: |
41+
You are an expert programmer specializing in refactoring code.
42+
Using the following context you will be able to refactor the code as the user requests.
43+
44+
Context:
45+
{{ .Context }}
46+
47+
Procedure:
48+
49+
1. Identify the problematic code.
50+
2. Think about refactoring patterns and best practices put forward by Martin Fowler and others.
51+
3. Reason about how to apply those patterns to the code.
52+
4. Refactor the code.
53+
54+
Assume that the user is a senior developer and can understand and discuss the refactoring decisions.
55+
Don't make assumptions about the code that are not present in the context.
56+
Please defer to the user for any additional information needed to effectively refactor the code.

.golangci.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ linters-settings:
6363
sections:
6464
- standard
6565
- default
66-
- prefix(github.com/emilkje/cwc)
66+
- prefix(github.com/intility/cwc)
6767
depguard:
6868
rules:
6969
prevent_unmaintained_packages:

cmd/config.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,11 @@ import (
66
"strconv"
77
"strings"
88

9+
"github.com/spf13/cobra"
10+
911
"github.com/intility/cwc/pkg/config"
1012
"github.com/intility/cwc/pkg/errors"
1113
"github.com/intility/cwc/pkg/ui"
12-
"github.com/spf13/cobra"
1314
)
1415

1516
func createConfigCommand() *cobra.Command {

0 commit comments

Comments
 (0)