-
Notifications
You must be signed in to change notification settings - Fork 2
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
Some simplifying changes #3
Conversation
var del = "" | ||
if paramCount() == 0: | ||
echo("error: specify at least one file") | ||
quit(1) |
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 also changed quit(0) to quit(1) because that's more logical - if an error happens there shouldn't be a successfull exit code.
except OSError: | ||
echo("error: no such file or directory") | ||
quit(0) | ||
echo("error: no such file or directory: " & del) |
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.
Also added path to the file to the error which may help the user in case when moving fails
else: | ||
trashHome = joinPath(getHomeDir(), ".local/share/Trash") | ||
getHomeDir() / ".local/share/Trash" |
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.
This can be also changed to
getHomeDir() / ".local" / "share" / "Trash"
btw, but I don't think that it's really needed :D
|
||
let | ||
t = getTime() | ||
formattedTime = t.format("yyyy-MM-dd") & "T" & t.format("HH:MM:ss") | ||
formattedTime = t.format("yyyy-MM-dd'T'HH:MM:ss") |
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.
This is documented in official docs for the times module if you're wondering:
Other strings can be inserted by putting them in ''.
Hey, That's wonderful! Thanks for these changes, and especially, for explaining each one. Real nice for someone still learning the language. And with regard to why Line 10 in 84ce5ce
Let me know if there's a better way to go about it. Thanks again :) |
@icyphox ah, ok! |
Just made some simple changes to make the program look a bit prettier ;)
(btw,
/
is fromospaths
module, which is exported byos
, and allows to create paths using a more "natural" way).Also, I didn't understand why you made
path
incrap
procedure avar string
instead of juststring
.