mirror of
https://github.com/RGBCube/nu_scripts
synced 2025-07-30 13:47:46 +00:00
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.
This commit is contained in:
parent
b442c96ec2
commit
82aacd5d54
2 changed files with 59 additions and 0 deletions
17
custom-completions/windows/README.md
Normal file
17
custom-completions/windows/README.md
Normal file
|
@ -0,0 +1,17 @@
|
|||
# windows completions
|
||||
|
||||
Completions for [Windows](https://www.microsoft.com/en-gb/windows)
|
||||
|
||||
## Usage
|
||||
|
||||
```nushell
|
||||
use windows-completions.nu *
|
||||
```
|
||||
|
||||
Afterwards, when you enter `win` and then press tab, the available commands will be displayed.
|
||||
|
||||
If you don't want to have all commands under the `win` prefix you could use the following instead.
|
||||
```nushell
|
||||
use windows-completions win *
|
||||
```
|
||||
|
42
custom-completions/windows/windows-completions.nu
Normal file
42
custom-completions/windows/windows-completions.nu
Normal file
|
@ -0,0 +1,42 @@
|
|||
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 }
|
||||
)
|
||||
}
|
||||
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue