|
xargs -I{} grep -l -e "Exec=.*${exported_app}.*" -e "Name=.*${exported_app}.*" "{}" | sed 's/./\\&/g' | |
When exporting the matching is pretty loose (surrounded by grabby .* regex) and when exporting something with a short name (1-3 characters) it can match a lot of things. Or in the case nothing is supplied it matches everything! (There should probably be a check whether exported_app is empty.)
I don't know what a good approach to the matching problem would be, since it's nice for users to be able to export something by a name guess that's only close enough. Maybe a confirmation dialog if it matches multiple desktop files?
I think it might be a good idea to have a flag to enable/disable searching of the Name= field.
Then when exporting by the command name you could use Exec=${exported_app} (notice the space at the end) to only match the provided command name. Since I'd assume someone using the command name would provide the full one.
PS the .* is not needed at the end.
distrobox/distrobox-export
Line 456 in c05b6a4
When exporting the matching is pretty loose (surrounded by grabby
.*regex) and when exporting something with a short name (1-3 characters) it can match a lot of things. Or in the case nothing is supplied it matches everything! (There should probably be a check whetherexported_appis empty.)I don't know what a good approach to the matching problem would be, since it's nice for users to be able to export something by a name guess that's only close enough. Maybe a confirmation dialog if it matches multiple desktop files?
I think it might be a good idea to have a flag to enable/disable searching of the
Name=field.Then when exporting by the command name you could use
Exec=${exported_app}(notice the space at the end) to only match the provided command name. Since I'd assume someone using the command name would provide the full one.PS the
.*is not needed at the end.