mirror of
https://github.com/onyx-and-iris/gignore.git
synced 2025-04-01 19:23:51 +01:00
Compare commits
3 Commits
a3c2d2cfbf
...
626e40b653
Author | SHA1 | Date | |
---|---|---|---|
626e40b653 | |||
fd9c7194c1 | |||
388a204299 |
16
CHANGELOG.md
16
CHANGELOG.md
@ -5,6 +5,22 @@ All notable changes to this project will be documented in this file.
|
|||||||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
||||||
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||||
|
|
||||||
|
# [0.3.0] - 2024-14-03
|
||||||
|
|
||||||
|
### Added
|
||||||
|
|
||||||
|
- CLI may now accept multiple template names, example `gignore go python`. One will be appended after the other.
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
|
||||||
|
- Filewriter now opens file in append mode.
|
||||||
|
|
||||||
|
# [0.2.0] - 2025-10-03
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
|
||||||
|
- Template .gitignore are now written concurrently.
|
||||||
|
|
||||||
# [0.1.0] - 2025-09-03
|
# [0.1.0] - 2025-09-03
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
|
@ -16,14 +16,14 @@ func main() {
|
|||||||
w := flag.CommandLine.Output()
|
w := flag.CommandLine.Output()
|
||||||
|
|
||||||
fmt.Fprint(w, "Usage of gignore:\n")
|
fmt.Fprint(w, "Usage of gignore:\n")
|
||||||
fmt.Fprintf(w, " gignore [flags] <template>\n")
|
fmt.Fprint(w, " gignore [flags] <template>\n")
|
||||||
fmt.Fprint(w, "\n")
|
fmt.Fprint(w, "\n")
|
||||||
|
|
||||||
fmt.Fprint(w, "Flags:\n")
|
fmt.Fprint(w, "Flags:\n")
|
||||||
flag.PrintDefaults()
|
flag.PrintDefaults()
|
||||||
|
|
||||||
fmt.Fprint(w, "\n")
|
fmt.Fprint(w, "\n")
|
||||||
fmt.Fprintf(w, "Example:\n")
|
fmt.Fprint(w, "Example:\n")
|
||||||
fmt.Fprint(w, " gignore go\n")
|
fmt.Fprint(w, " gignore go\n")
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -59,17 +59,18 @@ func main() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
args := flag.Args()
|
args := flag.Args()
|
||||||
if len(args) != 1 {
|
if len(args) == 0 {
|
||||||
flag.Usage()
|
flag.Usage()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
err := client.Create(args[0])
|
for _, arg := range args {
|
||||||
if err != nil {
|
err := client.Create(arg)
|
||||||
log.Fatalf("failed to create .gitignore file: %v", err)
|
if err != nil {
|
||||||
|
log.Fatalf("failed to create .gitignore file: %v", err)
|
||||||
|
}
|
||||||
|
fmt.Printf("√ created %s .gitignore file\n", arg)
|
||||||
}
|
}
|
||||||
|
|
||||||
fmt.Printf("√ created %s .gitignore file\n", args[0])
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func listTemplates(client *gignore.Client) error {
|
func listTemplates(client *gignore.Client) error {
|
||||||
|
@ -29,14 +29,14 @@ func (fw *FileWriter) writeContent(content []byte, dst io.Writer) (int64, error)
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (fw *FileWriter) Write(content []byte) (int, error) {
|
func (fw *FileWriter) Write(content []byte) (int, error) {
|
||||||
f, err := os.Create(fw.targetFileName)
|
f, err := os.OpenFile(fw.targetFileName, os.O_APPEND|os.O_CREATE|os.O_WRONLY, 0o600)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return 0, err
|
return 0, err
|
||||||
}
|
}
|
||||||
defer f.Close()
|
defer f.Close()
|
||||||
|
|
||||||
const header = `# Auto-generated .gitignore by gignore: github.com/onyx-and-iris/gignore`
|
const header = "# Auto-generated .gitignore by gignore: github.com/onyx-and-iris/gignore\n"
|
||||||
const footer = `# End of gignore: github.com/onyx-and-iris/gignore`
|
const footer = "\n# End of gignore: github.com/onyx-and-iris/gignore\n"
|
||||||
|
|
||||||
var sz int64
|
var sz int64
|
||||||
n, err := fw.writeContent([]byte(header), f)
|
n, err := fw.writeContent([]byte(header), f)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user