Removed old Go dependencies and document nli command line tool
This commit is contained in:
@@ -1,10 +0,0 @@
|
||||
all: sync
|
||||
|
||||
sync: build
|
||||
./dotfiles
|
||||
|
||||
delete: build
|
||||
./dotfiles --delete
|
||||
|
||||
build:
|
||||
go build
|
||||
@@ -2,7 +2,12 @@
|
||||
|
||||
My configuration files for the various tools that I use
|
||||
|
||||
# Setup
|
||||
# Usage
|
||||
|
||||
To create the necessary symlinks, use the `nli` command-line tool:
|
||||
|
||||
* `nli sync` To link everything
|
||||
* `nli sync --desync` To clean up all the links
|
||||
|
||||
## Arch:
|
||||
|
||||
|
||||
-57
@@ -1,57 +0,0 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"flag"
|
||||
"os"
|
||||
"os/exec"
|
||||
|
||||
log "github.com/sirupsen/logrus"
|
||||
)
|
||||
|
||||
func main() {
|
||||
deleteFlag := flag.Bool("delete", false, "Deletes the symlinks")
|
||||
|
||||
flag.Parse()
|
||||
|
||||
folders, err := os.ReadDir(".")
|
||||
if err != nil {
|
||||
log.WithFields(log.Fields{
|
||||
"folder": ".",
|
||||
"error": err,
|
||||
}).Fatal("Error reading directory")
|
||||
}
|
||||
|
||||
for _, dirStat := range folders {
|
||||
if dirStat.Name()[0] == '.' || !dirStat.IsDir() {
|
||||
continue
|
||||
}
|
||||
|
||||
homeDir, err := os.UserHomeDir()
|
||||
if err != nil {
|
||||
log.WithFields(log.Fields{"error": err}).Fatal("Error getting home directory")
|
||||
}
|
||||
|
||||
stowCmd := exec.Command("stow", "--verbose", "--restow", "--target", homeDir, dirStat.Name())
|
||||
|
||||
if *deleteFlag {
|
||||
stowCmd.Args = []string{"stow", "-D", "--verbose", "--target", homeDir, dirStat.Name()}
|
||||
}
|
||||
|
||||
var out bytes.Buffer
|
||||
var out2 bytes.Buffer
|
||||
|
||||
stowCmd.Stdout = &out
|
||||
stowCmd.Stderr = &out2
|
||||
|
||||
if err := stowCmd.Run(); err != nil {
|
||||
log.WithFields(log.Fields{
|
||||
"error": err,
|
||||
"directory": dirStat.Name(),
|
||||
"stdout": string(out.Bytes()),
|
||||
"stderr": string(out2.Bytes()),
|
||||
}).Fatal("Error stowing directory")
|
||||
}
|
||||
log.Info(string(out2.Bytes()))
|
||||
}
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
module github.com/NickyBoy89/dotfiles
|
||||
|
||||
go 1.17
|
||||
|
||||
require github.com/sirupsen/logrus v1.8.1
|
||||
|
||||
require golang.org/x/sys v0.0.0-20220622161953-175b2fd9d664 // indirect
|
||||
@@ -1,11 +0,0 @@
|
||||
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
|
||||
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
|
||||
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
||||
github.com/sirupsen/logrus v1.8.1 h1:dJKuHgqk1NNQlqoA6BTlM1Wf9DOH3NBjQyu0h9+AZZE=
|
||||
github.com/sirupsen/logrus v1.8.1/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0=
|
||||
github.com/stretchr/testify v1.2.2 h1:bSDNvY7ZPG5RlJ8otE/7V6gMiyenm9RtJ7IUVIAoJ1w=
|
||||
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
|
||||
golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20220622161953-175b2fd9d664 h1:wEZYwx+kK+KlZ0hpvP2Ls1Xr4+RWnlzGFwPP0aiDjIU=
|
||||
golang.org/x/sys v0.0.0-20220622161953-175b2fd9d664/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
Reference in New Issue
Block a user