-
-
Notifications
You must be signed in to change notification settings - Fork 21
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
feat: added time_stamp flag #93
feat: added time_stamp flag #93
Conversation
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.
+1
@Shinyzenith what do you think about? I think it is good
@Decodetalkers I'm wondering if we should make this the default, UNIX_TIME time isn't a great naming convention. What do you think? CC: @AndreasBackx Hi apologies for pinging but would like some of your input if possible -- would changing our naming scheme from wayshot-UNIX_TIME.encoding to wayshot-HUMANIZED_TIME.encoding be considered a breaking change? |
@Shinyzenith if you mean an ISO8601 timestamp, then yes. If you mean like "1 day ago", then I'd definitely say no. Also would make the former the default. I'd also make it wayshot-TIME.EXT so they're grouped if sorted by name. It's technically a breaking change, though we're in 0.x so I think this is fine. I'm away from a PC, though I'd let people override the name how they want and avoid any further name customisations. Though I think we already have this, cannot check rn. |
yes user can provide output file name . if no name is provided it saves file in $UNIX_TIMESTAMP-wayshot.$EXTENSION format which is a bit confusing hence this flag. |
Yes I am indeed referring to ISO8601 although this PR isn't formatted with respect to it. I will request that change if everyone agrees on this feature req.
PS: I don't think changing the naming conventions after we hit 1.x would be acceptable so this will only be entertained for the 0.x period but I will still try to keep it to a low frequency. @Decodetalkers Can I get an ack from you to make wayshot-ISO8601_ENCODED_TIME.EXT the new default? |
f8b3f93
to
63a89af
Compare
@Shinyzenith made the requested changes please review. |
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.
Looks good, I think we simply need the date as well as that's important. Then --timestamp
and use chrono
to make it all easier. Once that's done, I think this is good to go.
wayshot/src/cli.rs
Outdated
|
||
/// Uses time stamp(%H:%M:%S) as file name | ||
#[arg(short, long)] | ||
pub time_stamp: bool, |
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.
pub time_stamp: bool, | |
pub timestamp: bool, |
Timestamp is 1 word, --timestamp
is also better than --time-stamp
.
wayshot/src/utils.rs
Outdated
Ok(n) => get_hour_minute_from_unix_seconds(n.as_secs()), | ||
Err(_) => { | ||
tracing::error!("SystemTime before UNIX EPOCH!"); | ||
String::from("") |
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.
String::from("") | |
String::from("unknown") |
nitpick
wayshot/src/utils.rs
Outdated
fn get_hour_minute_from_unix_seconds(seconds: u64) -> String { | ||
let total_minutes = seconds / 60; | ||
let mut current_hour = (((total_minutes / 60) % 24) + 5) % 24; | ||
let mut current_minute = (total_minutes % 60) + 30; | ||
|
||
if current_minute > 60 { | ||
current_hour += 1; | ||
} | ||
|
||
current_minute = current_minute % 60; | ||
|
||
if current_hour == 24 { | ||
current_hour = 0; | ||
} | ||
|
||
format!("{}:{}:{}", current_hour, current_minute, seconds % 60) | ||
} |
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 only printing time HH:MM:SS
when we need the date and time. Though this actually made me think this format might be quite annoying to use because of the colons and possibly spaces: DD-MM-YY HH:MM:SS
. Could we go with 2024-12-31 23:59:59
? @Shinyzenith
Additionally, this function can be removed and we could use the chrono
package. Considering this is a binary, adding a dependency for time stuff is fine.
See the docs here: https://docs.rs/chrono/latest/chrono/format/index.html
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 only printing time HH:MM:SS when we need the date and time. Though this actually made me think this format might be quite annoying to use because of the colons and possibly spaces: DD-MM-YY HH:MM:SS. Could we go with 2024-12-31 23:59:59? @Shinyzenith
That is fine by me, doesn't seem to invasive and is pretty easy to read / reason through.
Additionally, this function can be removed and we could use the chrono package. Considering this is a binary, adding a dependency for time stuff is fine.
I initially had suggested not to increase the dependency graph but if you feel so, we can definitely go forth with chrono
. Apologies for the extra work 😅 @rachancheet .
CC: @AndreasBackx |
Apologies for the late reply! (In the future, feel free to ping me on Discord as well.) Got a new phone and hadn't setup GitHub yet and I don't check github.com too often. And again further apologies, I noticed that my format Also, now that I see it, should we use So do you peeps agree |
I think I would go ahead with this due solely due to the |
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.
Looks good, thank you! I would say we should make this the default, but we can land this.
wayshot/src/cli.rs
Outdated
@@ -43,4 +43,8 @@ pub struct Cli { | |||
/// Present a fuzzy selector for output/display selection | |||
#[arg(long, alias = "chooseoutput", conflicts_with_all = ["slurp", "output"])] | |||
pub choose_output: bool, | |||
|
|||
/// Uses time stamp(%H:%M:%S) as file name |
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.
/// Uses time stamp(%H:%M:%S) as file name | |
/// Uses `wayshot-YYYY_MM_DD-HH_MM_SS.ext` as a filename. |
I think default would be best. @rachancheet do you agree? If yes we can do so and land the merge. |
@rachancheet it should be removed your new function should be the body of the old default function. |
Done. @Shinyzenith @AndreasBackx Thanks for the guidance |
dcf7364
to
d472c71
Compare
d472c71
to
11b07bc
Compare
Signed-off-by: Shinyzenith <aakashsensharma@gmail.com>
11b07bc
to
0c531f1
Compare
Hi, I resolved the merge conflicts. |
currently default filename is "$UNIX_TIMESTAMP-wayshot.$EXTENSION" . This pr adds flag --time_stamp to use human read-able timestamp instead of seconds from UNIX_EPOCH .