9 Commits

Author SHA1 Message Date
3af8cd7c32 version bump 2025-05-16 22:07:14 +02:00
b9705ad793 Merge branch 'master' of https://github.com/Tilo-K/pastebin-cli into develop 2025-05-16 22:02:38 +02:00
25f48a1e94 chore: remove unused import 2025-05-16 22:01:02 +02:00
8ef0c317f9 remove .idea 2025-05-16 21:57:17 +02:00
75b9b52e25 feat: improve list command 2025-05-16 21:56:47 +02:00
Tilo
34e98b5702 chore: upgrade versions (#8) 2025-05-16 21:56:31 +02:00
f5b49e2b86 0.1.7 2024-05-07 20:40:22 +02:00
Tilo
9c5baf87e5 Develop (#7)
* Setting paste name to filename

* Version bump

* 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>

* feat: added releases

* Lockfile

* Maybe fix regex

* ver: 1.0.5

* homepage & release

* fixed

* we are getting dirty

* fix

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-05-07 20:37:18 +02:00
Tilo
8d3f195ea7 Develop (#6)
* Setting paste name to filename

* Version bump

* 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>

* feat: added releases

* Lockfile

* Maybe fix regex

* ver: 1.0.5

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-05-07 17:10:24 +02:00
4 changed files with 487 additions and 183 deletions

View File

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

612
Cargo.lock generated

File diff suppressed because it is too large Load Diff

View File

@@ -1,6 +1,6 @@
[package]
name = "pastebin-cli"
version = "0.1.5"
version = "0.1.8"
edition = "2021"
description = "A simple CLI for pastebin.com"
authors = ["Tilo K"]
@@ -17,15 +17,15 @@ eula = false
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
anyhow = "1.0.75"
chrono = "0.4.31"
clap = { version = "4.4.6", features = ["derive"] }
home = "0.5.5"
quick-xml = { version = "0.31.0", features = ["serde", "serialize"] }
reqwest = { version = "0.11.22", features = ["json"] }
rpassword = "7.2.0"
serde = { version = "1.0.189", features = ["serde_derive", "derive"] }
tokio = { version = "1.33.0", features = ["full"] }
anyhow = "1.0.98"
chrono = "0.4.41"
clap = { version = "4.5.38", features = ["derive"] }
home = "0.5.11"
quick-xml = { version = "0.37.5", features = ["serde", "serialize"] }
reqwest = { version = "0.12.15", features = ["json"] }
rpassword = "7.4.0"
serde = { version = "1.0.219", features = ["serde_derive", "derive"] }
tokio = { version = "1.45.0", features = ["full"] }
# The profile that 'cargo dist' will build with
[profile.dist]
@@ -41,7 +41,12 @@ ci = "github"
# The installers to generate for each app
installers = ["shell", "powershell", "npm", "homebrew", "msi"]
# Target platforms to build apps for (Rust target-triple syntax)
targets = ["aarch64-apple-darwin", "x86_64-apple-darwin", "x86_64-unknown-linux-gnu", "x86_64-pc-windows-msvc"]
targets = [
"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)
windows-archive = ".tar.gz"
# The archive format to use for non-windows builds (defaults .tar.xz)
@@ -53,4 +58,5 @@ pr-run-mode = "plan"
# Whether to install an updater program
install-updater = true
allow-dirty = ["ci"]
allow-dirty = ["ci"]
allow-dirty = ["ci"]

View File

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