-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Added basic importing function for exported lists! #2105
Conversation
libexec/scoop-import.ps1
Outdated
{ | ||
if($line -ne "") #Checks empty line! | ||
{ | ||
$appslist += $line.Split()[0] + " " |
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.
What if we have duplicate packages on the list or dependency of some package and the package itself?
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.
Duplicate packages are also going to into list but, because of the nature scoop install
they are not installed. But you are right, duplicates are trying to install by this script. I will look into it. Thx for your comments! 🥂
libexec/scoop-import.ps1
Outdated
|
||
|
||
$filePaths = $args | ||
importApps(createAppsList($filepaths)) |
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.
I think we should report %ERRORLEVEL%
with result of the operation.
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.
I will add this too. Thx again! 👍
Can import ignore lines that start with a # or ; char? |
@rasa Nope currently, but thx to you it will. 🥂
|
Since
Have I captured everything? @r15ch13? |
@rasa Thx for suggestions. 1 and 2 is done! As I said earlier, I'm pretty new to PS scripting but I try my best. 🥂 |
@rasa sounds about right. @yigitemres I don't want to be rude, but this https://blog.codinghorror.com/flattening-arrow-code/ might be a good read for you. 😃 |
@r15ch13 It could be worse. It could be spaghetti with switch cases and arrow code! 🤣 My first ever C++ homework is resulted with spaghetti code and I had to rewrite it just day before the deadline! I just write this sake of QoL. It will be possibly deleted or changed (if it is ever merged!) in time. I maybe calling these ifs as function (or found clever way to check string for multiple case with ease) in order to become a little more easy to read. Any fix or suggestions are welcomed as always! |
@rasa * for wildcards. We are both wrong. 😆 It should be Thx for warning. 🥂 |
try { | ||
scoop install $Matches.url $globalArgs.TrimEnd(" ") $archArgs.TrimEnd(" ") | ||
} | ||
catch { |
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.
I cannot figure out how to catch if $Matches.url not exist or not reachable? If anybody have suggestions, I'm very happy to hear it!
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.
You could check status code of the url HEAD
PS > Invoke-WebRequest -Uri 'community.spiceworks.com' -Method 'HEAD' | select StatusCode
StatusCode
----------
200
Will there be a I'm in favor of the
Thanks for all the hard work on this. |
else { | ||
return $false | ||
} | ||
} |
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.
I believe above can be reduced to this.
function checkFileExt ($file) {
return ([IO.Path]::GetExtension($file) -eq ".txt")
}
The above simplification can be applied to functions below and would make the code more concise and thus make it more readable.
What's the status of this merge request? I see that @yigitemres removed his repository. I started playing with
|
"I will be Bach" Arnold, probably... I will fork again and work on it. If anyone comes with cleaner version (which you should 😃) I will be happy. My main aim to try to implement this feature because of two reasons. First one is QoL change and the second one is that learning PS. Thanks for all ideas, suggestions and warnings. I hope that we will see this feature in the near future. 🥂 |
NecroBump?! Hi guys, It's been a long time. I remember that we have unfinished business with this unimplemented feature. I will be very happy if you can help me. I'm gonna try to add all(?) previously mentioned features (I have some objections about some of them) with clean code. If you have suggestions, please comment. 🥂 For a testing purposes I need something. Can somebody export of their scoop list and paste it here if;
I'm using WSLGentoo as a scoop replacement. Because of this, I need these exports for testing purposes. Installing scoop apps with many different conditions is a real burden for me for now. 😢 I hope that this will finished really soon with your helps. Have a nice day! 🤗 |
Final NecroBump! @scadu If you accept I have a mission for you. (Mission Impossible intensifies 😁) I think that no one interest with import function and I'm fully migrated from this package manager to another. If anyone have better solution please pr. Have a nice day! 🥂 |
Added basic importing function for exported lists! #1863
Feel free to fix any mistakes!
PS: I'm very new to ps1 scripting. Any suggestion can take time! 😄