1
Fork 0
mirror of https://github.com/RGBCube/nu_scripts synced 2025-08-02 07:07:46 +00:00
nu_scripts/custom-completions/windows/windows-completions.nu
Francesc Elies 82aacd5d54
windows nushell stuff (#1105)
Sometimes I have to use windows, 

I would like to have a place were I can find useful nushell stuff making
my easier and maybe eventually copy stuff other people might contribute.

Would you see this fit?

**NOTE**: I will gladly remove editorconfig if you prefer a separate pr
or you don't want it at all.
2025-04-29 08:56:26 -05:00

42 lines
1.6 KiB
Text

export module win {
# open in visual studio
export def "open in visual-studio" [file: path] {
let vswhere = $'($env."ProgramFiles(x86)")\Microsoft Visual Studio\Installer\vswhere.exe'
if not ($vswhere | path exists) { error make {msg: $"($vswhere) not found" } }
# https://github.com/microsoft/vswhere/wiki/Find-VC
let latest = ^$vswhere -latest | parse "{property}: {value}"
let installation_path = $latest | transpose --header-row | get installationPath.0
let vs = $'($installation_path)\Common7\IDE\devenv.exe'
if not ($vs | path exists) { error make {msg: $"($vs) not found" } }
run-external $vs /Edit ($file | path expand)
}
# file version and signature viewer from file
export def "read version" [file: path] {
^sigcheck -nobanner $file | lines | skip 1 | parse --regex '\s*(?<name>.+?):(?<value>.+)'
}
# application for CPU spikes, unhandled exception and hung window monitoring cli tool
#
# https://learn.microsoft.com/en-us/sysinternals/downloads/procdump#using-procdump
#
# Examples:
# Install ProcDump as the (AeDebug) postmortem debugger:
# procdump -ma -i c:\dumps
#
# Uninstall ProcDump as the (AeDebug) postmortem debugger:
# procdump -u
export extern "procdump" [ ...args: any ]
# list logical disks somehing akin to unix's df command
export def "disk free" [] {
(wmic logicaldisk get deviceid,size,freespace,volumename,description | str trim
| detect columns
| insert Use% { ($in.freespace|into int) / ($in.size|into int) * 100 }
)
}
}