common: Add helper function for running logging command

This commit is contained in:
George Kaklamanos 2023-11-30 20:50:26 +02:00
parent c078a13c8e
commit 3938e5c0c8
No known key found for this signature in database
GPG key ID: C0CAB8A6BDC9399D

View file

@ -7,6 +7,13 @@ pub struct OpenBinaryArgs {
pub resource_shortcut: i8,
}
pub struct LogBinaryArgs {
pub time: String,
pub method: String,
pub identifier: String,
pub resource: String,
}
pub fn run_bin(bin: Binary) -> BinaryResult {
use std::{
io::Read,
@ -36,3 +43,12 @@ pub fn run_open(args: OpenBinaryArgs, bin: Binary) -> BinaryResult {
auth_bin.push(args.resource_shortcut.to_string());
run_bin(auth_bin)
}
pub fn run_log(args: LogBinaryArgs, bin: Binary) -> BinaryResult {
let mut auth_bin = bin.clone();
auth_bin.push(args.time.clone());
auth_bin.push(args.method.clone());
auth_bin.push(args.identifier.clone());
auth_bin.push(args.resource.clone());
run_bin(auth_bin)
}