From e9dc01ffb547d0fa605bfe38b34672ddd5161be4 Mon Sep 17 00:00:00 2001 From: Max Audron Date: Tue, 7 Jun 2022 12:28:18 +0200 Subject: reorganize file structure and cleanup lints --- src/repo/repostate.rs | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 src/repo/repostate.rs (limited to 'src/repo/repostate.rs') diff --git a/src/repo/repostate.rs b/src/repo/repostate.rs new file mode 100644 index 0000000..ea3c5a6 --- /dev/null +++ b/src/repo/repostate.rs @@ -0,0 +1,36 @@ +use super::Repo; + +#[derive(Clone, Debug)] +pub enum RepoState { + Local, + Remote, + Synced, + Unknown, +} + +impl std::fmt::Display for RepoState { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + use ansi_term::Colour::{Blue, Green, Red, Yellow}; + + match self { + RepoState::Local => f.write_str(&Yellow.paint("LOCAL ").to_string()), + RepoState::Remote => f.write_str(&Blue.paint("REMOTE ").to_string()), + RepoState::Synced => f.write_str(&Green.paint("SYNCED ").to_string()), + RepoState::Unknown => f.write_str(&Red.paint("UNKNOWN").to_string()), + } + } +} + +impl From<&Repo> for RepoState { + fn from(repo: &Repo) -> Self { + if repo.repo.is_some() && repo.forge.is_some() { + RepoState::Synced + } else if repo.repo.is_some() { + RepoState::Local + } else if repo.forge.is_some() { + RepoState::Remote + } else { + RepoState::Unknown + } + } +} -- cgit v1.2.3 017bb03a0a88cd9ef4908331fd'>refslogtreecommitdiff
path: root/macros/src (unfollow)
Commit message (Expand)AuthorLines
2025-12-14release 1.7.11.7.1Max Audron-2/+2
2025-12-14fix non-sasl connection registrationMax Audron-9/+35
2025-12-14fix readme badge linksMax Audron-3/+3
2025-12-14update readme and remotesMax Audron-1/+14
2025-12-14release 1.7.01.7.0Max Audron-2/+2
2025-12-14add server passwordMax Audron-1/+6
2025-12-14update cargo dependenciesMax Audron-670/+505
2025-12-14update flake inputs to nixpkgs 25.11Max Audron-36/+41
2025-05-06fix rustls missing cryptoproviderMax Audron-1/+6
2025-05-06remove too commonly used used for shifty_eyesMax Audron-1/+1
2025-05-06fix truncate on unicodeMax Audron-10/+20
2025-05-06update dependenciesMax Audron-691/+1659
2024-08-12add nix build and moduleMax Audron-5/+427
2022-02-19remove jsonnet lock fileMax Audron-36/+0
2022-02-19fix deploy to work with gitlab agentMax Audron-4/+4
2021-10-22write tons of documentation and reorganize some modulesMax Audron-65/+300
2021-10-22remove wolfram alpha url shorteningMax Audron-1/+2
2021-10-20remove failing wolfram alpha test casesMax Audron-105/+55
2021-10-20bump version to 1.6.2Max Audron-3/+2
2021-10-20prepare for release on crates.ioMax Audron-39/+65
2021-10-20add async docs to macro crate and bump versionMax Audron-9/+10
2021-10-20change hook errors to be logged as warningsMax Audron-3/+3
2021-10-20fix configuration not loading correctly on release buildsMax Audron-8/+23
2021-10-19replace sedregex crate8-rework-sedMax Audron-20/+358
2021-10-19add formatting trait for irc codesMax Audron-0/+129
2021-10-17fix links in readmeMax Audron-2/+2