1use std::collections::HashMap;
2
3fn main() {
4 let app = biolib::load("test-team/hello-world:0.0.2").expect("Failed to load app");
5 println!("Loaded app: {}", app.uri());
6
7 let mut job = app.cli(None, None, None, true).expect("Failed to run app");
8
9 let exit_code = job.get_exit_code().expect("Failed to get exit code");
10 let stdout = job.get_stdout().expect("Failed to get stdout");
11 let stderr = job.get_stderr().expect("Failed to get stderr");
12
13 println!("Exit code: {exit_code}");
14 println!("Stdout: {}", String::from_utf8_lossy(&stdout));
15 if !stderr.is_empty() {
16 eprintln!("Stderr: {}", String::from_utf8_lossy(&stderr));
17 }
18
19 let files = job.list_output_files().expect("Failed to list files");
20 for file in &files {
21 println!("Output file: {}", file.path);
22 }
23}
24
25fn _example_with_args() {
26 let app = biolib::load("test-team/hello-world:0.0.2").expect("Failed to load app");
27
28 let args = vec!["--name".to_string(), "World".to_string()];
29 let mut job = app
30 .cli(Some(args), None, None, true)
31 .expect("Failed to run app");
32
33 println!(
34 "Stdout: {}",
35 String::from_utf8_lossy(&job.get_stdout().unwrap())
36 );
37}
38
39fn _example_with_files() {
40 let app = biolib::load("test-team/hello-world:0.0.2").expect("Failed to load app");
41
42 let mut files = HashMap::new();
43 files.insert("input.txt".to_string(), b"Hello from file".to_vec());
44
45 let mut job = app
46 .cli(None, None, Some(files), true)
47 .expect("Failed to run app");
48
49 let exit_code = job.get_exit_code().unwrap();
50 println!("Exit code: {exit_code}");
51
52 job.save_files("output_dir", true)
53 .expect("Failed to save files");
54}
55
56fn _example_search() {
57 let results = biolib::search(Some("hello"), None, 5).expect("Search failed");
58 for uri in &results {
59 println!("Found: {uri}");
60 }
61}
62
63fn _example_get_result() {
64 let job_id = "some-job-uuid";
65 let mut job = biolib::get_result(job_id, None).expect("Failed to get result");
66
67 let stdout = job.get_stdout().expect("Failed to get stdout");
68 println!("Stdout: {}", String::from_utf8_lossy(&stdout));
69}
70
71fn _example_non_blocking() {
72 let app = biolib::load("test-team/hello-world:0.0.2").expect("Failed to load app");
73
74 let mut job = app
75 .cli(None, None, None, false)
76 .expect("Failed to start job");
77
78 println!("Job ID: {}", job.id());
79 println!("Share link: {}", job.get_shareable_link());
80
81 job.wait(None).expect("Failed to wait for job");
82
83 let exit_code = job.get_exit_code().unwrap();
84 println!("Exit code: {exit_code}");
85}