Skip to content

Commit

Permalink
Switch to using .tomeignore file (#3)
Browse files Browse the repository at this point in the history
* Switch to using .tomeignore file

* Include a .tomeignore file in repo
  • Loading branch information
zph authored Aug 7, 2024
1 parent 2578b77 commit 271fb23
Show file tree
Hide file tree
Showing 8 changed files with 10 additions and 5 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ See [docs](./docs/tome-cli.md) for expanded instructions
- root folder's folder names
- root folder's scripts
- root script's flags and arguments (when they satisfy the --complete and TOME_COMPLETION interface)
- Gitignore like syntax for ignoring scripts by using a `.tome_ignore` file at base of root folder
- Gitignore like syntax for ignoring scripts by using a `.tomeignore` file at base of root folder [example](./cmd/embeds/.tomeignore)

# Capabilities

Expand Down
5 changes: 3 additions & 2 deletions cmd/alias.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ type ScriptTemplate struct {
Root string
}

//go:embed tome-wrapper.sh.tmpl
//go:embed embeds/tome-wrapper.sh.tmpl
//go:embed embeds/.tomeignore
var content embed.FS

var writePath string
Expand Down Expand Up @@ -52,7 +53,7 @@ Read the template script 'tome-wrapper.sh.tmpl' for more information on how the
ExecutableAlias: config.ExecutableName(),
Root: config.RootDir(),
}
t, err := template.ParseFS(content, "tome-wrapper.sh.tmpl")
t, err := template.ParseFS(content, "embeds/tome-wrapper.sh.tmpl")
// Capture any error
if err != nil {
log.Fatalln(err)
Expand Down
2 changes: 2 additions & 0 deletions cmd/embeds/.tomeignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Ignore 'hidden' files
.*
File renamed without changes.
2 changes: 1 addition & 1 deletion cmd/struct.go
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ func NewConfig() *Config {
}

func (c *Config) IgnorePatterns() *gitignore.GitIgnore {
tomeIgnore := ".tome_ignore"
tomeIgnore := ".tomeignore"
tomeIgnorePath := filepath.Join(c.RootDir(), tomeIgnore)
_, err := os.Stat(tomeIgnorePath)
if err == nil {
Expand Down
1 change: 0 additions & 1 deletion examples/.tome_ignore

This file was deleted.

3 changes: 3 additions & 0 deletions examples/.tomeignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
folder/executable-ignored
# Ignore any files starting with leading period to respect "hidden" files
.*
Empty file.

0 comments on commit 271fb23

Please sign in to comment.