Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

improve: add show-repo, upload, upgrade all #151

Open
wants to merge 13 commits into
base: main
Choose a base branch
from

Conversation

ZookaOnGit
Copy link
Collaborator

@ZookaOnGit ZookaOnGit commented Jan 6, 2025

also handle sysInstall and sysUninstall events

Fixes #94
Fixes #146
Fixes #96
Fixes #80
Fixes #95

handle sysInstall and Uninstall events
mpkg/src/scripts/Mudlet_Package_Manager_CLI.lua Outdated Show resolved Hide resolved
-- if no errors removing then install
if mpkg.remove(args) then
tempTimer(2, function() mpkg.install(args) end)
if args == "all" then
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we block a package named all from being submitted?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've turned this into the regex itself now, but it is probably wise as a precaution to block all

mpkg/src/scripts/Mudlet_Package_Manager_CLI.lua Outdated Show resolved Hide resolved
mpkg/src/scripts/Mudlet_Package_Manager_CLI.lua Outdated Show resolved Hide resolved
mpkg/src/scripts/Mudlet_Package_Manager_CLI.lua Outdated Show resolved Hide resolved
@ZookaOnGit ZookaOnGit marked this pull request as draft January 7, 2025 06:03
@ZookaOnGit ZookaOnGit marked this pull request as ready for review January 7, 2025 09:55
@ZookaOnGit
Copy link
Collaborator Author

  • latest push implements fixed network handling; mpkg will abort any commands if a valid json listing cannot be found (and retry to get one)
  • reduced commands down to 6 minimal ones
  • ability to click most things (click to upgrade, show, etc)

@ZookaOnGit
Copy link
Collaborator Author

added case-insensitive to install, remove and show

Copy link
Member

@vadi2 vadi2 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We are get closer and closer!

The mpkg menu looks really clean now, great work with this @ZookaOnGit

end
local sf = string.format

mpkg.echo("Listing locally installed packages:")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would this also work? Packages can't be installed another way anyhow.

Suggested change
mpkg.echo("Listing locally installed packages:")
mpkg.echo("Listing installed packages:")


for i = 1, #help do
mpkg.echo(help[i])
end

mpkg.echoLink("", "Visit https://packages.mudlet.org/upload to share your package.", function() mpkg.openWebUploads() end, "open browser at upload website", true)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe have a space or a newline after? The first command you type gets appended to the period:

image

@@ -338,8 +454,9 @@ function mpkg.search(args)
for i = 1, #packages do
if string.find(string.lower(packages[i]["mpackage"]), args, 1, true) or string.find(string.lower(packages[i]["title"]), args, 1, true) then
mpkg.echo("")
mpkg.echo("Package: <b>" .. packages[i]["mpackage"] .. "</b> (version: " .. packages[i]["version"] .. ")")
mpkg.echo(" " .. packages[i]["title"] .. "")
mpkg.echoLink(" ", f"<b>{packages[i]['mpackage']}</b> (v{packages[i]['version']}) ", function() mpkg.show(packages[i]["mpackage"], true) end, "show details", true)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The [install now] link is super nice.

One feedback, it doesn't work super well on a default package that was already installed - I expected the default package to be reinstalled with a version from the repo:

image

Copy link
Collaborator Author

@ZookaOnGit ZookaOnGit Jan 8, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, this is the problem with allowing non-versioned packages. If we enable updates to non-versioned packages we allow local user-made packages with the same name to possibly be overwritten.

Current workflow workaround we be to remove said package, then mpkg install <repo_version>

Also fixed the [install now] link message to only show when a searched package isn't installed locally.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where should we collect this kind of knowledge - perhaps a FAQ page for the package manager in the manual?

table.insert(mpkg.aliases, tempAlias("^(mpkg|mp) remove(?: (.+))?$", function() mpkg.remove(matches[3]) end))
table.insert(mpkg.aliases, tempAlias("^(mpkg|mp) show(?: (.+))?$", function() mpkg.show(matches[3]) end))
table.insert(mpkg.aliases, tempAlias("^(mpkg|mp) search(?: (.+))?$", function() mpkg.search(matches[3]) end))
--table.insert(mpkg.aliases, tempAlias("^(mpkg|mp) update$", function() mpkg.updatePackageList(false) end))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this one be commented out?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oops, no

if not mpkg.silentFailures then
mpkg.echo("Failed to download package listing.")
mpkg.silentFailures = true
end
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was having network issues again and it was hard to diagnose without being able to see what the issue was, perhaps we use mpkg.debug for this?

Suggested change
end
end
if mpkg.debug then
mpkg.echo(f"Error downloading package listing: {arg[1]}")
end

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, right. That was so you didn't keep getting the message over and over due to automated listing updates, I did not think of that possibility doing it manually. I will make it show if called manually.

Copy link
Member

@vadi2 vadi2 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚀 great work on this update!

@ZookaOnGit
Copy link
Collaborator Author

getting closer!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants