Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 16 additions & 16 deletions module/core/process_tools/src/process.rs
Original file line number Diff line number Diff line change
Expand Up @@ -234,22 +234,22 @@ mod private
// # Returns:
// A `Result` containing a `Report` on success, which includes the command's output,
// or an error if the command fails to execute or complete.
// pub fn run_with_shell( self, exec_path : &str, ) -> Result< Report, Report >
// {
// let ( program, args ) =
// if cfg!( target_os = "windows" )
// {
// ( "gspread", [ "/C", exec_path ] )
// }
// else
// {
// ( "sh", [ "-c", exec_path ] )
// };
// self
// .args( args.into_iter().map( OsString::from ).collect::< Vec< _ > >() )
// .bin_path( program )
// .run()
// }
pub fn run_with_shell( self, exec_path : &str, ) -> Result< Report, Report >
{
let ( program, args ) =
if cfg!( target_os = "windows" )
{
( "cmd", [ "/C", exec_path ] )
}
else
{
( "sh", [ "-c", exec_path ] )
};
self
.args( args.into_iter().map( OsString::from ).collect::< Vec< _ > >() )
.bin_path( program )
.run()
}
}

/// Process command output.
Expand Down
142 changes: 71 additions & 71 deletions module/move/gspread/src/commands/gspread_cells.rs
Original file line number Diff line number Diff line change
@@ -1,72 +1,72 @@
//!
//! Cells commands.
//! set command -> set specified values in specified columns in specified row.
//!
mod private
{
use clap::Subcommand;
use crate::*;
use actions::gspread::get_spreadsheet_id_from_url;
#[ derive( Debug, Subcommand ) ]
pub enum Commands
{
#[ command( name = "set" ) ]
Set
{
#[ arg( long ) ]
select_row_by_key : String,
#[ arg( long ) ]
json : String,
#[ arg( long ) ]
url : String,
#[ arg( long ) ]
tab : String
}
}
pub async fn command
(
hub : &SheetsType,
commands : Commands
)
{
match commands
{
Commands::Set { select_row_by_key, json, url, tab } =>
{
let spreadsheet_id = get_spreadsheet_id_from_url( url.as_str() ).unwrap();
let result = actions::gspread_cells_set::action
(
&hub,
select_row_by_key.as_str(),
json.as_str(),
spreadsheet_id,
tab.as_str()
).await;
match result
{
Ok( msg ) => println!( "{}", msg ),
Err( error ) => println!( "{}", error )
}
}
}
}
}
crate::mod_interface!
{
own use
{
command,
Commands
};
//!
//! Cells commands.
//! set command -> set specified values in specified columns in specified row.
//!

mod private
{
use clap::Subcommand;

use crate::*;
use actions::gspread::get_spreadsheet_id_from_url;

#[ derive( Debug, Subcommand ) ]
pub enum Commands
{
#[ command( name = "set" ) ]
Set
{
#[ arg( long ) ]
select_row_by_key : String,

#[ arg( long ) ]
json : String,

#[ arg( long ) ]
url : String,

#[ arg( long ) ]
tab : String
}

}

pub async fn command
(
hub : &SheetsType,
commands : Commands
)
{
match commands
{
Commands::Set { select_row_by_key, json, url, tab } =>
{
let spreadsheet_id = get_spreadsheet_id_from_url( url.as_str() ).unwrap();

let result = actions::gspread_cells_set::action
(
&hub,
select_row_by_key.as_str(),
json.as_str(),
spreadsheet_id,
tab.as_str()
).await;

match result
{
Ok( msg ) => println!( "{}", msg ),
Err( error ) => println!( "{}", error )
}
}
}
}
}

crate::mod_interface!
{
own use
{
command,
Commands
};
}
Loading