all repos — min @ 161908115174d007d6b3489d71ebdabf6fa64835

A small but practical concatenative programming language.

Added additional mmm.json checks.
h3rald h3rald@h3rald.com
Sat, 02 Dec 2023 08:16:44 +0000
commit

161908115174d007d6b3489d71ebdabf6fa64835

parent

47c253622a02e756d3d95fb544d91d00dbfa096b

2 files changed, 11 insertions(+), 2 deletions(-)

jump to
M min.ymlmin.yml

@@ -1,5 +1,5 @@

author: Fabio Cevasco description: A small but practical concatenative programming language and shell. -id: 127048373 +id: 132245884 name: min version: 0.42.0
M minpkg/core/mmm.nimminpkg/core/mmm.nim

@@ -76,7 +76,7 @@ debug "Local registry up-to-date: $#" % [$updatedLocal]

proc init*(MMM: var MinModuleManager) = let pwd = getCurrentDir() - if dirExists(pwd / "mmm.json"): + if fileExists(pwd / "mmm.json"): raiseError "The current directory already contains a managed module (mmm.json already exists)" debug "Creating mmm.json file" let json = """

@@ -109,6 +109,9 @@ if global:

dir = MMM.globalDir / name / version else: dir = MMM.localDir / name / version + let pwd = getCurrentDir() + if not global and not fileExists(pwd / "mmm.json"): + raiseError "mmm.json not found in current directory. Please run min init to initialize your managed module." if not dir.dirExists(): raiseError "Module '$#' (version: $#) is not installed." % [name, versionLabel] notice "Uninstalling module $#@$#..." % [name, versionLabel]

@@ -123,6 +126,9 @@ raiseError "Unable to uninstall module $#@$#" % [name, versionLabel]

notice "Uninstall complete." proc uninstall*(MMM: var MinModuleManager) = + let pwd = getCurrentDir() + if not fileExists(pwd / "mmm.json"): + raiseError "mmm.json not found in current directory. Please run min init to initialize your managed module." try: notice "Uninstalling all local managed modules..." MMM.localDir.removeDir()

@@ -136,6 +142,9 @@ if global:

dir = MMM.globalDir / name / version else: dir = MMM.localDir / name / version + let pwd = getCurrentDir() + if not fileExists(pwd / "mmm.json"): + raiseError "mmm.json not found in current directory. Please run min init to initialize your managed module." if dir.dirExists(): raiseAlreadyInstalledError "Module '$#' (version: $#) is already installed." % [name, version] dir.createDir()