diff --git a/packages/cli/src/utils/github.rs b/packages/cli/src/utils/github.rs index 780d16c..4e85416 100644 --- a/packages/cli/src/utils/github.rs +++ b/packages/cli/src/utils/github.rs @@ -3,7 +3,7 @@ use std::env::current_dir; use anyhow::{bail, Context, Result}; use serde::{Deserialize, Serialize}; -use lune::utils::net::{get_github_owner_and_repo, get_request_user_agent_header}; +use super::net::{get_github_owner_and_repo, get_request_user_agent_header}; #[derive(Clone, Deserialize, Serialize)] pub struct ReleaseAsset { diff --git a/packages/cli/src/utils/mod.rs b/packages/cli/src/utils/mod.rs index 828523e..d7d3780 100644 --- a/packages/cli/src/utils/mod.rs +++ b/packages/cli/src/utils/mod.rs @@ -1,3 +1,4 @@ pub mod files; pub mod github; pub mod listing; +pub mod net; diff --git a/packages/cli/src/utils/net.rs b/packages/cli/src/utils/net.rs new file mode 100644 index 0000000..9625650 --- /dev/null +++ b/packages/cli/src/utils/net.rs @@ -0,0 +1,13 @@ +pub fn get_github_owner_and_repo() -> (String, String) { + let (github_owner, github_repo) = env!("CARGO_PKG_REPOSITORY") + .strip_prefix("https://github.com/") + .unwrap() + .split_once('/') + .unwrap(); + (github_owner.to_owned(), github_repo.to_owned()) +} + +pub fn get_request_user_agent_header() -> String { + let (github_owner, github_repo) = get_github_owner_and_repo(); + format!("{github_owner}-{github_repo}-cli") +} diff --git a/packages/lib/src/lib.rs b/packages/lib/src/lib.rs index d6eba6c..5daf569 100644 --- a/packages/lib/src/lib.rs +++ b/packages/lib/src/lib.rs @@ -3,8 +3,8 @@ use std::{collections::HashSet, process::ExitCode, sync::Arc}; use mlua::prelude::*; use tokio::{sync::mpsc, task}; -pub mod globals; -pub mod utils; +pub(crate) mod globals; +pub(crate) mod utils; use crate::{ globals::{ diff --git a/packages/lib/src/utils/table.rs b/packages/lib/src/utils/table.rs index 409f2e0..111b049 100644 --- a/packages/lib/src/utils/table.rs +++ b/packages/lib/src/utils/table.rs @@ -7,6 +7,7 @@ pub struct TableBuilder<'lua> { tab: LuaTable<'lua>, } +#[allow(dead_code)] impl<'lua> TableBuilder<'lua> { pub fn new(lua: &'lua Lua) -> LuaResult { let tab = lua.create_table()?;