amulecmd: expose search filters (type, extension, availability, size) - #542
Merged
mrjimenez merged 2 commits intoMay 11, 2026
Merged
Conversation
… via flags
Wires the existing CEC_Search_Tag filter parameters through to the CLI.
The EC packet has long supported file_type / extension / availability
/ min_size / max_size; the GUI populates them but amulecmd was passing
empty defaults. Add a small inline parser that strips optional flags
out of the search arguments:
search <global|local|kad> [--type T] [--extension E] [--avail N]
[--min-size N[KMG]] [--max-size N[KMG]] keyword [keyword ...]
Sizes accept binary-multiplier suffixes (K=1024, M=K*1024, G=M*1024)
or no suffix for bytes; min-size/max-size are wired through as uint64
to match the underlying EC tag (the previous uint32 locals capped
sizes at 4 GiB even though the EC tag itself is 64-bit).
Also fixes a typo ("extention" -> "extension") in the local
variable that was already shadowing the parameter name.
Update docs/man/amulecmd.1 (English) with the new --type / --extension / --avail / --min-size / --max-size flags, and add the new translatable strings to po/amule.pot. The localized man pages (amulecmd.de.1, amulecmd.es.1, amulecmd.fr.1, amulecmd.hu.1, amulecmd.it.1, amulecmd.ro.1, amulecmd.ru.1, amulecmd.tr.1, amulecmd.zh_TW.1) are intentionally left at their current state — the new sections need to be added in each language when translator capacity is available. Users invoking man amulecmd under those locales will not see the new filter syntax until that follow-up lands. Runtime help (`amulecmd help search`) is documented via gettext and falls back to English on locales that haven't picked up the new strings yet, so the CLI itself stays usable everywhere.
This was referenced May 8, 2026
3 tasks
got3nks
added a commit
to got3nks/amule
that referenced
this pull request
Jul 21, 2026
…ale daemons (amule-project#542) A headless amuled started without LANG / LC_* (systemd, Docker) runs under the POSIX/C locale, whose ASCII codeset cannot represent accented or other non-ASCII UTF-8 filesystem paths. wxConvFileName then fails to open them, so an accented shared directory silently becomes invisible to the file scan — reproduced on glibc: `LC_ALL=C` finds 0 files in an accented share where a UTF-8 locale finds them. This newly bites the remote shared-folder config (amule-project#530), whose whole point is configuring a headless core, but it affects all of amuled's non-ASCII file handling. aMuleInitLocale() now promotes LC_CTYPE to UTF-8 (C.UTF-8, falling back to en_US.UTF-8) when the resolved codeset is bare ASCII, and exports it so the promotion survives wx re-resolving the locale from the environment during app init — a plain setlocale() alone is undone there. The guard is the codeset itself, so a deliberate UTF-8 or latin1 locale is never overridden, and musl (already UTF-8 in its C locale) never triggers it. Windows is exempt (wide-char filesystem APIs). Verified on an ARM64 glibc VM: with the fix an accented shared folder is found under a bare environment, an explicit `LC_ALL=C`, and healthy UTF-8 locales alike, with no change for a real locale (it_IT.UTF-8).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #395.
Motivation
amulecmd help searchexposes only the three search modes (global,local,kad) plus a free-text query. The advanced filters the GUI uses (file type, extension, availability, min/max size) are already implemented end-to-end on the EC layer —CEC_Search_Tagaccepts all of them, the GUI populates them, the daemon honors them — but the CLI was passing empty defaults, so CLI users have no way to narrow searches like the GUI can.Change
src/TextClient.cpp:--type / --extension / --avail / --min-size / --max-sizeflags from the search arguments. Flags can appear before, after, or interleaved with the keyword(s); unrecognized tokens are joined as the search query.CEC_Search_Tagconstructor instead of the previously-hardcoded empty defaults.min_size/max_sizetypes fromuint32touint64to match the EC tag — the previous code silently capped sizes at 4 GiB even though the wire protocol carries 64 bits.extention→extension) in the local variable shadowing the parameter name.docs/man/amulecmd.1andpo/amule.pot: document the new flags.Examples
amulecmd help searchprints the full filter syntax with examples.Localization
Only the English man page is updated — the localized variants (
amulecmd.de.1,.es.1,.fr.1,.hu.1,.it.1,.ro.1,.ru.1,.tr.1,.zh_TW.1) need follow-up translation work for the new section. Until that lands, users invokingman amulecmdunder those locales won't see the new filter syntax in the manpage; the runtime help (amulecmd help search) is gettext-driven and falls back to English where translations are missing, so the CLI itself stays usable everywhere.The new
wxTRANSLATE-wrapped strings have been added topo/amule.pot. The per-language.pofiles are intentionally left alone —msgmergewill mark the new strings as untranslated on the next sync, which is the standard gettext flow.Testing
Verified end-to-end on macOS 26.4 / Apple Silicon against a running aMule build of master, ed2k Global search via a connected server:
--type Iso--min-size 500MSample entries from test 2 are all
.isofilenames; sample entries from test 3 all show file sizes ≥ 500 MiB. Filters reach the daemon, are applied, and reduce the result set as expected.Also verified:
help searchdisplays the new long-form documentation correctly.Type 'help search' to get more help.--min-size 8G) flow through to the EC tag without truncation.Compatibility
No API changes. Existing
search global X/search local X/search kad Xcalls continue to work exactly as before — the new flags are purely additive and optional.