mirror of
https://github.com/BillyOutlast/posthog.git
synced 2026-02-04 03:01:23 +01:00
feat: add skeleton of sourcemap commands (#29578)
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
pub mod auth;
|
||||
pub mod upload;
|
||||
use clap::{Parser, Subcommand};
|
||||
|
||||
use crate::error::CapturedError;
|
||||
@@ -18,6 +19,36 @@ pub struct Cli {
|
||||
pub enum Commands {
|
||||
/// Authenticate with PostHog, storing a personal API token locally
|
||||
Login,
|
||||
|
||||
#[command(about = "Upload a directory of bundled chunks to PostHog")]
|
||||
Sourcemap {
|
||||
#[command(subcommand)]
|
||||
cmd: SourcemapCommand,
|
||||
},
|
||||
}
|
||||
|
||||
#[derive(Subcommand)]
|
||||
pub enum SourcemapCommand {
|
||||
/// Inject each bundled chunk with a posthog chunk ID
|
||||
Inject {
|
||||
/// The directory containing the bundled chunks
|
||||
#[arg(short, long)]
|
||||
directory: String,
|
||||
|
||||
/// Where to write the injected chunks. If not provided, the original files will be overwritten
|
||||
#[arg(short, long)]
|
||||
output: Option<String>,
|
||||
},
|
||||
/// Upload the bundled chunks to PostHog
|
||||
Upload {
|
||||
/// The directory containing the bundled chunks
|
||||
#[arg(short, long)]
|
||||
directory: String,
|
||||
|
||||
/// The build ID to associate with the uploaded chunks
|
||||
#[arg(short, long)]
|
||||
build: Option<String>,
|
||||
},
|
||||
}
|
||||
|
||||
impl Cli {
|
||||
@@ -28,6 +59,16 @@ impl Cli {
|
||||
Commands::Login => {
|
||||
auth::login()?;
|
||||
}
|
||||
Commands::Sourcemap { cmd } => match cmd {
|
||||
SourcemapCommand::Inject {
|
||||
directory: _,
|
||||
output: _,
|
||||
} => return Ok(()),
|
||||
SourcemapCommand::Upload {
|
||||
directory: _,
|
||||
build: _,
|
||||
} => return Ok(()),
|
||||
},
|
||||
}
|
||||
|
||||
Ok(())
|
||||
|
||||
5
rust/posthog-cli/src/commands/upload.rs
Normal file
5
rust/posthog-cli/src/commands/upload.rs
Normal file
@@ -0,0 +1,5 @@
|
||||
use anyhow::Error;
|
||||
|
||||
pub fn upload() -> Result<(), Error> {
|
||||
Ok(())
|
||||
}
|
||||
Reference in New Issue
Block a user