File tree Expand file tree Collapse file tree 1 file changed +26
-0
lines changed Expand file tree Collapse file tree 1 file changed +26
-0
lines changed Original file line number Diff line number Diff line change 1+ use codesnap:: config:: { CodeSnap , CommandLineContentBuilder , Content } ;
2+ use std:: process:: Command ;
3+
4+ pub fn main ( ) -> anyhow:: Result < ( ) > {
5+ let command = "echo \" Hello, World!\" " ;
6+ let output = Command :: new ( "sh" )
7+ . arg ( "-c" )
8+ . arg ( command)
9+ . output ( )
10+ . expect ( "failed to execute process" ) ;
11+
12+ let command_line_content = CommandLineContentBuilder :: default ( )
13+ . full_command ( command)
14+ . content ( String :: from_utf8_lossy ( & output. stdout ) . into_owned ( ) )
15+ . build ( )
16+ . unwrap ( ) ;
17+
18+ let command_content = Content :: CommandOutput ( vec ! [ command_line_content] ) ;
19+ let snapshot = CodeSnap :: from_default_theme ( ) ?
20+ . content ( command_content)
21+ . build ( ) ?
22+ . create_snapshot ( ) ?;
23+
24+ // Copy the snapshot data to the clipboard
25+ snapshot. raw_data ( ) ?. copy ( )
26+ }
You can’t perform that action at this time.
0 commit comments