Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,12 @@
"image": "mcr.microsoft.com/devcontainers/go:2-1.24-bookworm",
"features": {
"ghcr.io/guiyomh/features/golangci-lint:0": {}
},
"customizations": {
"vscode": {
"extensions": [
"eamodio.gitlens"
]
}
}
}
28 changes: 28 additions & 0 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# This workflow will build a golang project
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-go

name: Go

on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]

jobs:

build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: '1.24'

- name: Build
run: make build

- name: Test
run: make test
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
BACKLOG/
logs/
backup
*.log
dist/backup
16 changes: 16 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Makefile to build the project and place the binary in the dist/ directory

.PHONY: build clean deps test

deps:
go mod tidy

build: deps
@mkdir -p dist
go build -o dist/backup ./backup/main.go

test:
go test ./... -v

clean:
rm -rf dist
19 changes: 19 additions & 0 deletions backup/cmd/backup.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package cmd

import (
"github.com/spf13/cobra"
)

// backupCmd represents the backup command
var backupCmd = &cobra.Command{
Use: "backup",
Short: "Perform backup operations",
Long: `The backup subcommand allows you to perform backup operations.`,
Run: func(cmd *cobra.Command, args []string) {
// TODO: Implement backup logic
},
}

func init() {
RootCmd.AddCommand(backupCmd)
}
19 changes: 19 additions & 0 deletions backup/cmd/config.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package cmd

import (
"github.com/spf13/cobra"
)

// configCmd represents the config command
var configCmd = &cobra.Command{
Use: "config",
Short: "Manage configuration settings",
Long: `The config subcommand allows you to manage configuration settings.`,
Run: func(cmd *cobra.Command, args []string) {
// TODO: Implement config logic
},
}

func init() {
RootCmd.AddCommand(configCmd)
}
21 changes: 21 additions & 0 deletions backup/cmd/root.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package cmd

import (
"os"

"github.com/spf13/cobra"
)

// RootCmd represents the base command when called without any subcommands
var RootCmd = &cobra.Command{
Use: "backup-tool",
Short: "A tool for managing backups",
Long: `backup-tool is a CLI tool for managing backups and configurations.`,
}

// Execute adds all child commands to the root command and sets flags appropriately.
func Execute() {
if err := RootCmd.Execute(); err != nil {
os.Exit(1)
}
}
9 changes: 9 additions & 0 deletions backup/cmd/root_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package cmd

import (
"testing"
)

func TestExecute(t *testing.T) {
// TODO: Add tests for the Execute function
}
9 changes: 9 additions & 0 deletions backup/main.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package main

import (
"backup-rsync/backup/cmd"
)

func main() {
cmd.Execute()
}
10 changes: 10 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
module backup-rsync

go 1.24.9

require github.com/spf13/cobra v1.10.1

require (
github.com/inconshreveable/mousetrap v1.1.0 // indirect
github.com/spf13/pflag v1.0.9 // indirect
)
10 changes: 10 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
github.com/cpuguy83/go-md2man/v2 v2.0.6/go.mod h1:oOW0eioCTA6cOiMLiUPZOpcVxMig6NIQQ7OS05n1F4g=
github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8=
github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw=
github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
github.com/spf13/cobra v1.10.1 h1:lJeBwCfmrnXthfAupyUTzJ/J4Nc1RsHC/mSRU2dll/s=
github.com/spf13/cobra v1.10.1/go.mod h1:7SmJGaTHFVBY0jW4NXGluQoLvhqFQM+6XSKD+P4XaB0=
github.com/spf13/pflag v1.0.9 h1:9exaQaMOCwffKiiiYk6/BndUBv+iRViNW+4lEMi0PvY=
github.com/spf13/pflag v1.0.9/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=