Compare commits
2 Commits
00d155251b
...
67cb4f8c82
Author | SHA1 | Date | |
---|---|---|---|
|
67cb4f8c82 | ||
09546907e5 |
15
CHANGELOG.md
15
CHANGELOG.md
@ -6,6 +6,21 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||||||
|
|
||||||
## [Unreleased]
|
## [Unreleased]
|
||||||
|
|
||||||
|
## [0.5.0] - 2024-12-15
|
||||||
|
|
||||||
|
### Added
|
||||||
|
- allow taking a local path
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
- *(deps)* update rust crate serde to v1.0.216
|
||||||
|
- *(deps)* update rust crate prost to v0.13.4
|
||||||
|
|
||||||
|
### Other
|
||||||
|
- *(deps)* update rust crate clap to v4.5.23
|
||||||
|
- *(deps)* update all dependencies
|
||||||
|
- *(deps)* update rust crate tracing-subscriber to v0.3.19
|
||||||
|
- *(deps)* update rust crate tracing to v0.1.41
|
||||||
|
|
||||||
## [0.4.0] - 2024-11-23
|
## [0.4.0] - 2024-11-23
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
|
@ -26,4 +26,4 @@ hex = { version = "0.4.3" }
|
|||||||
toml = { version = "0.8.14" }
|
toml = { version = "0.8.14" }
|
||||||
|
|
||||||
[workspace.package]
|
[workspace.package]
|
||||||
version = "0.4.0"
|
version = "0.5.0"
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
use std::path::PathBuf;
|
||||||
|
|
||||||
use tonic::transport::{Channel, ClientTlsConfig};
|
use tonic::transport::{Channel, ClientTlsConfig};
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
@ -14,15 +16,18 @@ pub struct State {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub enum Backend {
|
pub enum Backend {
|
||||||
Local,
|
Local { path_override: Option<PathBuf> },
|
||||||
Remote { url: String },
|
Remote { url: String },
|
||||||
}
|
}
|
||||||
|
|
||||||
impl State {
|
impl State {
|
||||||
pub async fn new(backend: Backend) -> anyhow::Result<Self> {
|
pub async fn new(backend: Backend) -> anyhow::Result<Self> {
|
||||||
let (querier, commander) = match &backend {
|
let (querier, commander) = match &backend {
|
||||||
Backend::Local => {
|
Backend::Local { path_override } => {
|
||||||
let storage = Storage::new();
|
let mut storage = Storage::new();
|
||||||
|
if let Some(path_override) = path_override {
|
||||||
|
storage.with_base(path_override);
|
||||||
|
}
|
||||||
let engine = storage.load()?;
|
let engine = storage.load()?;
|
||||||
let events = Events::default();
|
let events = Events::default();
|
||||||
let engine = SharedEngine::from(engine);
|
let engine = SharedEngine::from(engine);
|
||||||
@ -53,15 +58,21 @@ impl State {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub fn unlock(&self) {
|
pub fn unlock(&self) {
|
||||||
if let Backend::Local = &self.backend {
|
if let Backend::Local { path_override } = &self.backend {
|
||||||
let storage = Storage::new();
|
let mut storage = Storage::new();
|
||||||
|
if let Some(path_override) = path_override {
|
||||||
|
storage.with_base(path_override);
|
||||||
|
}
|
||||||
storage.clear_lock_file();
|
storage.clear_lock_file();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn info(&self) -> Option<anyhow::Result<String>> {
|
pub fn info(&self) -> Option<anyhow::Result<String>> {
|
||||||
if let Backend::Local = &self.backend {
|
if let Backend::Local { path_override } = &self.backend {
|
||||||
let storage = Storage::new();
|
let mut storage = Storage::new();
|
||||||
|
if let Some(path_override) = path_override {
|
||||||
|
storage.with_base(path_override);
|
||||||
|
}
|
||||||
return Some(storage.info());
|
return Some(storage.info());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
use std::path::PathBuf;
|
||||||
|
|
||||||
use clap::{Parser, Subcommand, ValueEnum};
|
use clap::{Parser, Subcommand, ValueEnum};
|
||||||
use hyperlog_tui::{
|
use hyperlog_tui::{
|
||||||
commander,
|
commander,
|
||||||
@ -15,6 +17,9 @@ struct Command {
|
|||||||
|
|
||||||
#[arg(long = "backend-url", required_if_eq("backend", "remote"))]
|
#[arg(long = "backend-url", required_if_eq("backend", "remote"))]
|
||||||
backend_url: Option<String>,
|
backend_url: Option<String>,
|
||||||
|
|
||||||
|
#[arg(long = "local-path")]
|
||||||
|
local_path: Option<PathBuf>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(ValueEnum, Clone)]
|
#[derive(ValueEnum, Clone)]
|
||||||
@ -90,7 +95,9 @@ pub async fn execute() -> anyhow::Result<()> {
|
|||||||
let backend_url = cli.backend_url;
|
let backend_url = cli.backend_url;
|
||||||
|
|
||||||
let backend = match backend {
|
let backend = match backend {
|
||||||
BackendArg::Local => Backend::Local,
|
BackendArg::Local => Backend::Local {
|
||||||
|
path_override: cli.local_path.clone(),
|
||||||
|
},
|
||||||
BackendArg::Remote => Backend::Remote {
|
BackendArg::Remote => Backend::Remote {
|
||||||
url: backend_url.expect("backend-url to be set"),
|
url: backend_url.expect("backend-url to be set"),
|
||||||
},
|
},
|
||||||
|
Loading…
x
Reference in New Issue
Block a user