Browse Source

Moved to the switch syntax

environments/development/deployments/31
Drew Short 7 years ago
parent
commit
0c7e29054f
  1. 33
      src/spm/spm.moon

33
src/spm/spm.moon

@ -344,7 +344,7 @@ installPackage = (requestedPackage, installPath, doUpdate) ->
for filePath, requestedInstallPath in pairs(packageInfo.files)
installedPath
if string.find(requestedInstallPath, "^//")
if string.find(requestedInstallPath, "^//")
localInstalledPath = string.sub(requestedInstallPath, 2)
if not fs.exists(localInstalledPath)
fs.makeDirectory(localInstalledPath)
@ -475,19 +475,18 @@ updatePackage = (requestedPackage) ->
else
installPackage(args[2], nil, true)
if args[1] == "list"
tPacks = listPackages(args[2])
printPackages(tPacks)
elseif args[1] == "info"
provideInfo(args[2])
elseif args[1] == "install" or args[1] == "add"
installPackage(args[2], args[3], false)
elseif args[1] == "update" or args[1] == "upgrade"
updatePackage(args[2])
elseif args[1] == "uninstall" or args[1] == "remove"
uninstallPackage(args[2])
elseif args[1] == "copy"
copyPackage(args[2], args[3])
else
printUsage()
return
switch args[1]
when "list"
printPackages(listPackages(args[2]))
when "info"
provideInfo(args[2])
when "install" or "add"
installPackage(args[2], args[3], false)
when "update" or "upgrade"
updatePackage(args[2])
when "uninstall" or "remove"
uninstallPackage(args[2])
when "copy"
copyPackage(args[2], args[3])
else
printUsage()
Loading…
Cancel
Save