-
-
Notifications
You must be signed in to change notification settings - Fork 20
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
Add Shorthand for Install Command #43
Conversation
use username/repository for github use ./example.AppImage for local file with relative path use /dir/example.AppImage for local file with absolute path
This pull request is being automatically deployed with Vercel (learn more). 🔍 Inspect: https://vercel.com/srevinsaju/zap/Bqg1RmdaGdaFrRoQ8RqLhrUb48iy |
Looks really neat! Thank you for your patch! 🎉 |
I have fix things to change. |
@@ -12,7 +14,7 @@ import ( | |||
|
|||
func installAppImageOptionsFromCLIContext(context *cli.Context) (types.InstallOptions, error) { | |||
executable := context.String("executable") | |||
appName := context.Args().First() | |||
context, appName := parseSourceFromAppName(context, context.Args().First()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it possible to calculate the appName
from the parameter too, like
zap install repo/software1
should automatically set the appName = software1
and for local files
zap install ./super-cool-x86_64.AppImage
it should set appName = super-cool
@@ -74,7 +74,7 @@ func parseSourceFromAppName(context *cli.Context, appName string) (*cli.Context, | |||
filePath := "file://" + appName | |||
context.Set("from", filePath) | |||
splitted := strings.Split(appName, "/") | |||
return context, splitted[len(splitted)-1] | |||
return context, strings.ReplaceAll(splitted[len(splitted)-1], "-x86_64.AppImage", "") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Haha, that actually won't really help if the user's architecture is 32-bit for example.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
in case if the user's architecture is 32 bit, the file name will be someapp-i386.AppImage
or someapp-i686.AppImage
. If the user is using an arm 32, it will be someapp-armhf.AppImage
or someapp-arm64.AppImage
. There are certain apps which have this format someapp-4233cfe-x86_64.AppImage
where the 4233cfe
is the version of the app. My best guess is that, probably you should:
- split the filename by
-
- take the first part of it
- replace
_
by-
and set appname as the result of the change.
@hadihammurabi are you still working on this, or shall I hand it over to @kadern0 ? |
Yes, i still collecting cpu architectures types. |
@hadihammurabi it's there in the zap source code, https://github.com/srevinsaju/zap/blob/main/internal/helpers/arch.go, gives a list of supported architectures, but my proposed solution was more simpler than needing the list of architectures, but if it helps 🙂 |
@hadihammurabi ping |
use username/repository for github
use ./example.AppImage for local file with relative path
use /dir/example.AppImage for local file with absolute path
example: