mirror of
https://github.com/traxys/Nixfiles.git
synced 2026-03-06 20:51:08 +01:00
gaming: Add a script to extract wow-notes
This commit is contained in:
parent
78209207a9
commit
80eeca7102
4 changed files with 38 additions and 0 deletions
|
|
@ -18,6 +18,7 @@
|
|||
xivlauncher
|
||||
obs-studio
|
||||
pulseaudio
|
||||
wow-note
|
||||
];
|
||||
|
||||
home.file = {
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@
|
|||
push-to-talk = pkgs.callPackage ./push-to-talk.nix { };
|
||||
pulse8-cec = pkgs.callPackage ./pulse8-cec.nix { };
|
||||
weakauras-companion = pkgs.callPackage ./weakauras-companion.nix { };
|
||||
wow-note = pkgs.callPackage ./wow-note { };
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
|
|||
7
pkgs/wow-note/default.nix
Normal file
7
pkgs/wow-note/default.nix
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
{ lua, runCommand }:
|
||||
runCommand "wow-note" { buildInputs = [ lua ]; } ''
|
||||
mkdir -p $out/bin
|
||||
cat ${./wow_note.lua}> $out/bin/wow-note
|
||||
chmod +x $out/bin/wow-note
|
||||
patchShebangs --host $out/bin/wow-note
|
||||
''
|
||||
29
pkgs/wow-note/wow_note.lua
Executable file
29
pkgs/wow-note/wow_note.lua
Executable file
|
|
@ -0,0 +1,29 @@
|
|||
#!/usr/bin/env lua
|
||||
|
||||
if arg[1] == nil then
|
||||
io.stderr:write("Missing note name argument\n")
|
||||
os.exit(1)
|
||||
end
|
||||
|
||||
local data, error = loadfile(
|
||||
os.getenv("HOME") .. "/GameData/WoW/World of Warcraft/_retail_/WTF/Account/114770488#3/SavedVariables/Notes.lua"
|
||||
)
|
||||
|
||||
if data == nil then
|
||||
io.stderr:write(error .. "\n")
|
||||
os.exit(1)
|
||||
end
|
||||
|
||||
data()
|
||||
|
||||
for _, note in ipairs(NotesData.notes) do
|
||||
if note.title == arg[1] then
|
||||
local hdl = io.popen("wl-copy", "w")
|
||||
hdl:write(note.text)
|
||||
hdl:close()
|
||||
os.exit(0)
|
||||
end
|
||||
end
|
||||
|
||||
io.stderr:write("Note not found\n")
|
||||
os.exit(1)
|
||||
Loading…
Add table
Add a link
Reference in a new issue