15 Commits

Author SHA1 Message Date
113fc9db80 chore: upgrade versions 2025-05-16 21:54:06 +02:00
5bcdde3fe5 fix 2024-05-07 20:36:36 +02:00
0606ef082a we are getting dirty 2024-05-07 20:35:12 +02:00
008556ab4d fixed 2024-05-07 20:33:04 +02:00
bd54946b94 homepage & release 2024-05-07 17:12:02 +02:00
a6db41c0ca ver: 1.0.5 2024-05-07 17:09:27 +02:00
4656fc09f6 Maybe fix regex 2024-05-07 17:08:41 +02:00
511012e3bf Merge branch 'master' of https://github.com/Tilo-K/pastebin-cli into develop 2024-05-07 17:06:24 +02:00
e200099589 Lockfile 2024-05-07 17:06:18 +02:00
Tilo
83b1817dc3 Merge branch 'master' into develop 2024-05-07 16:54:13 +02:00
d081f3d083 feat: added releases 2024-05-07 16:52:11 +02:00
Tilo
8239356868 Merge branch 'master' into develop 2024-03-04 22:56:58 +01:00
dependabot[bot]
5fe8588b73 Bump mio from 0.8.10 to 0.8.11 (#2)
* Setting paste name to filename (#1)

* Setting paste name to filename

* Version bump

* chore: Update dependencies

* chore: version bump

* License update

* chore: license

* Bump mio from 0.8.10 to 0.8.11

Bumps [mio](https://github.com/tokio-rs/mio) from 0.8.10 to 0.8.11.
- [Release notes](https://github.com/tokio-rs/mio/releases)
- [Changelog](https://github.com/tokio-rs/mio/blob/master/CHANGELOG.md)
- [Commits](https://github.com/tokio-rs/mio/compare/v0.8.10...v0.8.11)

---
updated-dependencies:
- dependency-name: mio
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: Tilo <Tilo-K@users.noreply.github.com>
Co-authored-by: Tilo-K <tiloklarenbeek@gmail.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-03-04 22:56:09 +01:00
f69496afdb Version bump 2023-10-26 21:57:27 +02:00
a2e8dab9b0 Setting paste name to filename 2023-10-26 21:55:41 +02:00
4 changed files with 11 additions and 30 deletions

View File

@@ -40,7 +40,7 @@ permissions:
on: on:
push: push:
tags: tags:
- '[0-9]+.[0-9]+.[0-9]+' - '**[0-9]+.[0-9]+.[0-9]+*'
pull_request: pull_request:
jobs: jobs:

2
Cargo.lock generated
View File

@@ -746,7 +746,7 @@ dependencies = [
[[package]] [[package]]
name = "pastebin-cli" name = "pastebin-cli"
version = "0.1.8" version = "0.1.5"
dependencies = [ dependencies = [
"anyhow", "anyhow",
"chrono", "chrono",

View File

@@ -1,6 +1,6 @@
[package] [package]
name = "pastebin-cli" name = "pastebin-cli"
version = "0.1.8" version = "0.1.5"
edition = "2021" edition = "2021"
description = "A simple CLI for pastebin.com" description = "A simple CLI for pastebin.com"
authors = ["Tilo K"] authors = ["Tilo K"]
@@ -41,12 +41,7 @@ ci = "github"
# The installers to generate for each app # The installers to generate for each app
installers = ["shell", "powershell", "npm", "homebrew", "msi"] installers = ["shell", "powershell", "npm", "homebrew", "msi"]
# Target platforms to build apps for (Rust target-triple syntax) # Target platforms to build apps for (Rust target-triple syntax)
targets = [ targets = ["aarch64-apple-darwin", "x86_64-apple-darwin", "x86_64-unknown-linux-gnu", "x86_64-pc-windows-msvc"]
"aarch64-apple-darwin",
"x86_64-apple-darwin",
"x86_64-unknown-linux-gnu",
"x86_64-pc-windows-msvc",
]
# The archive format to use for windows builds (defaults .zip) # The archive format to use for windows builds (defaults .zip)
windows-archive = ".tar.gz" windows-archive = ".tar.gz"
# The archive format to use for non-windows builds (defaults .tar.xz) # The archive format to use for non-windows builds (defaults .tar.xz)

View File

@@ -1,8 +1,10 @@
use chrono::prelude::*;
use chrono::DateTime; use chrono::DateTime;
use clap::{Parser, Subcommand}; use clap::{Parser, Subcommand};
use std::fs; use std::fs;
use std::path::PathBuf; use std::path::PathBuf;
mod keys; mod keys;
mod pastebin; mod pastebin;
@@ -77,33 +79,17 @@ async fn list(max_results: Option<u16>) {
let line = "-".repeat(5); let line = "-".repeat(5);
println!("{}Top {} pastes{}", line, max_results.unwrap_or(10), line); println!("{}Top {} pastes{}", line, max_results.unwrap_or(10), line);
let mut max_length = 8;
let max = resp.iter().map(|paste| paste.paste_title.len()).max();
if max.is_some() {
if max.unwrap() > max_length {
max_length = max.unwrap();
}
}
for paste in resp { for paste in resp {
let mut title = paste.paste_title; let mut title = paste.paste_title;
if title == "" { if title == "" {
title = "Untitled".to_owned(); title = "Untitled".to_owned();
} }
title = pad_string(&title, max_length); let naive = NaiveDateTime::from_timestamp_opt(paste.paste_date.into(), 0).unwrap();
let datetime = DateTime::from_timestamp(paste.paste_date.into(), 0).unwrap(); let datetime: DateTime<Utc> = DateTime::from_utc(naive, Utc);
let formatted_date = datetime.format("%Y-%m-%d %H:%M:%S"); let newdate = datetime.format("%Y-%m-%d %H:%M:%S");
println!("{}\t{}\t{}", title, formatted_date, paste.paste_url); println!("{}\t{}\t{}", title, newdate, paste.paste_url);
} }
} }
fn pad_string(s: &str, length: usize) -> String {
let mut s = s.to_owned();
while s.len() < length {
s.push(' ');
}
s
}