lukesampson / pshazz

Give your powershell some pizazz.
The Unlicense
577 stars 40 forks source link

fix throw exception when user_themedir doesn't exist #44

Closed chawyehsu closed 8 years ago

chawyehsu commented 8 years ago

pshazz list cmd will throw exception if $user_themedir doesn't exist. The $user_themedir wouldn't be created unless a user create it or type pshazz new <name> cmd, this fix it, user no need to create $user_themedir. And it put Default themes on Custom themes, which should looks better.

before:
~ $ pshazz list
Custom themes:
gci : Cannot find path 'C:\Users\hanabi\pshazz' because it does not exist.
At C:\Users\hanabi\AppData\Local\scoop\apps\pshazz\0.2016.03.24.1\libexec\pshaz
z-list.ps1:8 char:2
+     gci "$dir" "*.json" |% { "  $($_.name -replace '.json$', '')" }
+     ~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (C:\Users\hanabi\pshazz:String)
   [Get-ChildItem], ItemNotFoundException
    + FullyQualifiedErrorId : PathNotFound,Microsoft.PowerShell.Commands.GetCh
   ildItemCommand

Default themes:
  awan
  default
  keepprompt
  lukes
  microsoft
  msys
  myty
  tonic
  xpando
~ $
after:
~ $ pshazz list
Default themes:
  awan
  default
  keepprompt
  lukes
  microsoft
  msys
  myty
  tonic
  xpando
Custom themes:

~ $
lukesampson commented 8 years ago

Nice. Thank you!