1
0
mirror of https://github.com/AvengeMedia/DankMaterialShell.git synced 2026-04-09 15:22:13 -04:00

clipboard: make CLI keep CL item in-memory again

This commit is contained in:
bbedward
2026-04-06 16:09:10 -04:00
parent e224417593
commit 3318864ece
4 changed files with 105 additions and 133 deletions

View File

@@ -53,7 +53,6 @@ var (
clipCopyPasteOnce bool
clipCopyType string
clipCopyDownload bool
clipCopyCacheFile string
clipJSONOutput bool
)
@@ -192,8 +191,6 @@ func init() {
clipCopyCmd.Flags().BoolVarP(&clipCopyPasteOnce, "paste-once", "o", false, "Exit after first paste")
clipCopyCmd.Flags().StringVarP(&clipCopyType, "type", "t", "text/plain;charset=utf-8", "MIME type")
clipCopyCmd.Flags().BoolVarP(&clipCopyDownload, "download", "d", false, "Download URL as image and copy as file")
clipCopyCmd.Flags().StringVar(&clipCopyCacheFile, "cache-file", "", "")
clipCopyCmd.Flags().MarkHidden("cache-file")
clipWatchCmd.Flags().BoolVar(&clipJSONOutput, "json", false, "Output as JSON")
clipHistoryCmd.Flags().BoolVar(&clipJSONOutput, "json", false, "Output as JSON")
@@ -224,13 +221,6 @@ func init() {
}
func runClipCopy(cmd *cobra.Command, args []string) {
if clipCopyCacheFile != "" {
if err := clipboard.ServeCacheFile(clipCopyCacheFile, clipCopyType, clipCopyPasteOnce); err != nil {
log.Fatalf("serve cache file: %v", err)
}
return
}
var data []byte
copyFromStdin := false

View File

@@ -5,6 +5,7 @@ package main
import (
"os"
"github.com/AvengeMedia/DankMaterialShell/core/internal/clipboard"
"github.com/AvengeMedia/DankMaterialShell/core/internal/log"
)
@@ -30,6 +31,8 @@ func init() {
}
func main() {
clipboard.MaybeServeAndExit()
if os.Geteuid() == 0 {
log.Fatal("This program should not be run as root. Exiting.")
}

View File

@@ -5,6 +5,7 @@ package main
import (
"os"
"github.com/AvengeMedia/DankMaterialShell/core/internal/clipboard"
"github.com/AvengeMedia/DankMaterialShell/core/internal/log"
)
@@ -27,6 +28,8 @@ func init() {
}
func main() {
clipboard.MaybeServeAndExit()
if os.Geteuid() == 0 {
log.Fatal("This program should not be run as root. Exiting.")
}