mirror of
https://github.com/danielmiessler/Fabric.git
synced 2026-02-12 15:05:10 -05:00
### CHANGES - Introduce `cmd` directory for all main application binaries. - Move all Go packages into the `internal` directory. - Rename the `restapi` package to `server` for clarity. - Consolidate patterns and strategies into a new `data` directory. - Group all auxiliary scripts into a new `scripts` directory. - Move all documentation and images into a `docs` directory. - Update all Go import paths to reflect the new structure. - Adjust CI/CD workflows and build commands for new layout.
31 lines
646 B
Go
31 lines
646 B
Go
package cli
|
|
|
|
import (
|
|
"fmt"
|
|
"os"
|
|
|
|
"github.com/atotto/clipboard"
|
|
)
|
|
|
|
func CopyToClipboard(message string) (err error) {
|
|
if err = clipboard.WriteAll(message); err != nil {
|
|
err = fmt.Errorf("could not copy to clipboard: %v", err)
|
|
}
|
|
return
|
|
}
|
|
|
|
func CreateOutputFile(message string, fileName string) (err error) {
|
|
var file *os.File
|
|
if file, err = os.Create(fileName); err != nil {
|
|
err = fmt.Errorf("error creating file: %v", err)
|
|
return
|
|
}
|
|
defer file.Close()
|
|
if _, err = file.WriteString(message); err != nil {
|
|
err = fmt.Errorf("error writing to file: %v", err)
|
|
} else {
|
|
fmt.Printf("\n\n... written to %s\n", fileName)
|
|
}
|
|
return
|
|
}
|