-
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(file_templates): Add filetemplates module for easy bootsrapping …
…of common files (now editorconfig only)
- Loading branch information
1 parent
a33954c
commit d2fa6e5
Showing
4 changed files
with
65 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package editorconfig | ||
|
||
import ( | ||
file_templates_cmd "github.com/sikalabs/slut/cmd/file_templates" | ||
"github.com/sikalabs/slut/file_templates/editorconfig" | ||
|
||
"github.com/spf13/cobra" | ||
) | ||
|
||
var Cmd = &cobra.Command{ | ||
Use: "editorconfig", | ||
Short: "Create basic editorconfig", | ||
Aliases: []string{"ec"}, | ||
Args: cobra.NoArgs, | ||
Run: func(c *cobra.Command, args []string) { | ||
editorconfig.CreateEditorconfig() | ||
}, | ||
} | ||
|
||
func init() { | ||
file_templates_cmd.Cmd.AddCommand(Cmd) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package file_templates | ||
|
||
import ( | ||
"github.com/sikalabs/slut/cmd/root" | ||
"github.com/spf13/cobra" | ||
) | ||
|
||
var Cmd = &cobra.Command{ | ||
Use: "file-templates", | ||
Short: "Create common files from templates", | ||
Aliases: []string{"ft"}, | ||
} | ||
|
||
func init() { | ||
root.RootCmd.AddCommand(Cmd) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package editorconfig | ||
|
||
import "io/ioutil" | ||
|
||
func CreateEditorconfig() { | ||
content := []byte(` | ||
root = true | ||
[*] | ||
indent_style = space | ||
indent_size = 2 | ||
charset = utf-8 | ||
trim_trailing_whitespace = true | ||
insert_final_newline = true | ||
end_of_line = lf | ||
max_line_length = off | ||
[Makefile] | ||
indent_style = tab | ||
[*.go] | ||
indent_style = tab | ||
`) | ||
err := ioutil.WriteFile(".editorconfig", content, 0644) | ||
if err != nil { | ||
panic(err) | ||
} | ||
} |