id stringlengths 20 30 | source stringclasses 1
value | chunk_index int64 0 520k | token_count int32 154 512 | content stringlengths 185 57.5k |
|---|---|---|---|---|
rust_dataset_chunk_511400 | rust_dataset.txt | 511,400 | 512 | map(OsString::from);
assert_eq!(
arguments(share.into_iter()),
["terminal", "--working-directory", r"\\server\share"].map(OsString::from)
);
let session = ["my\"session"].map(OsString::from);
assert_eq!(
arguments(session.into_iter()),
["te... |
rust_dataset_chunk_511401 | rust_dataset.txt | 511,401 | 512 | 1 MB main-thread stack. Increase it to 8 MB to match Linux.
// Release builds optimize the frame down, so this is only needed for non-release profiles.
if cfg!(target_os = "windows") && std::env::var("PROFILE").unwrap_or_default() != "release" {
println!("cargo:rustc-link-arg=/STACK:8388608");
}
... |
rust_dataset_chunk_511402 | rust_dataset.txt | 511,402 | 512 | ::ConnectToSession,
envs,
input::{
actions::{initial_panes_from_cli, Action},
config::{Config, ConfigError},
options::Options,
},
setup::Setup,
};
pub(crate) use zellij_utils::sessions::list_sessions;
pub(crate) fn kill_all_sessions(yes: bool) {
match get_sessions() {
... |
rust_dataset_chunk_511403 | rust_dataset.txt | 511,403 | 512 | .unwrap()
{
println!("Abort.");
process::exit(1);
}
}
for session in &dead_sessions {
delete_session_impl(&session.0, force);
}
process::exit(0);
}
pub(crate) fn kill_session(target_session: &Option<String>) {
match target_session {
Some(targ... |
rust_dataset_chunk_511404 | rust_dataset.txt | 511,404 | 512 | command.arg("terminal");
if let Some(session) = &request.session {
command.arg(session);
if request.create {
command.arg("--create");
}
}
if let Some(cwd) = &request.cwd {
command.arg("--working-directory").arg(cwd);
}
command
.env_remove(zellij_u... |
rust_dataset_chunk_511405 | rust_dataset.txt | 511,405 | 512 | !("✗ {}", refused);
failed = true;
}
if !plan.install.is_empty() || !plan.remove.is_empty() {
for outcome in platform::apply(&plan.install, &plan.remove, setup.replace_existing) {
let verb = if outcome.install { "" } else { "Removed: " };
let mark ... |
rust_dataset_chunk_511406 | rust_dataset.txt | 511,406 | 512 | Args,
run_daemonized: bool,
ip: Option<IpAddr>,
port: Option<u16>,
cert: Option<PathBuf>,
key: Option<PathBuf>,
startup_timeout: Option<u64>,
) {
// TODO: move this outside of this function
let (config, _layout, config_options, _config_without_layout, _config_options_without_layout) =
... |
rust_dataset_chunk_511407 | rust_dataset.txt | 511,407 | 512 | it's name
create_token(name, read_only)
.map(|(token, token_name)| {
let access_type = if read_only { " (read-only)" } else { "" };
format!("{}: {}{}", token_name, token, access_type)
})
.map_err(|e| e.to_string())
}
#[cfg(not(feature = "web_server_capability"))]
pu... |
rust_dataset_chunk_511408 | rust_dataset.txt | 511,408 | 512 | " [READ-ONLY]" } else { "" };
res.push(format!(
"{}: created at {}{}",
t.name, t.created_at, access_type
))
}
res
})
.map_err(|e| e.to_string())
}
#[cfg(not(feature = "web_server_capability"))]
pub(crate) f... |
rust_dataset_chunk_511409 | rust_dataset.txt | 511,409 | 512 | web server status!"
);
std::process::exit(2);
}
pub(crate) fn toggle_tray_icon_at(socket: &std::path::Path) -> Result<(), String> {
match zellij_utils::app_control::send_app_request_to(
socket,
&zellij_utils::app_control::AppRequest::ToggleTrayIcon,
) {
Ok(zellij_utils::app_con... |
rust_dataset_chunk_511410 | rust_dataset.txt | 511,410 | 512 | (&session_name) {
attach_with_cli_client(cli_action, &session_name, config);
} else {
eprintln!(
"Session '{}' not found. The following sessions are active:",
session_name
);
l... |
rust_dataset_chunk_511411 | rust_dataset.txt | 511,411 | 512 | <String>) -> String {
match get_active_session() {
ActiveSession::None => {
eprintln!("There is no active session!");
std::process::exit(1);
},
ActiveSession::One(session_name) => {
if let Some(ref requested) = requested_session_name {
if *... |
rust_dataset_chunk_511412 | rust_dataset.txt | 511,412 | 512 | let plugin_url = match &config {
Some(config)
if config
.plugins
.aliases
.contains_key(zellij_utils::prompt::PROMPT_PLUGIN_ALIAS) =>
{
zellij_utils::prompt::PROMPT_PLUGIN_ALIAS.to_owned()
},
_ => zellij_utils::prom... |
rust_dataset_chunk_511413 | rust_dataset.txt | 511,413 | 512 | _options.clone();
let mut opts = opts.clone();
let mut is_a_reconnect = false;
let mut should_create_detached = false;
let mut layout_info = client_layout_info.clone();
let mut new_session_cwd = None;
if let Some(reconnect_to_session) = &reconnect_to_session {
... |
rust_dataset_chunk_511414 | rust_dataset.txt | 511,414 | 512 | );
}
if !args.initial_command.is_empty() {
eprintln!("Cannot run an initial command on a remote session.");
std::process::exit(2);
}
#[cfg(feature = "web_server_capability")]
if let Err(e) = zellij_... |
rust_dataset_chunk_511415 | rust_dataset.txt | 511,415 | 512 | .clone());
reconnect_to_session = start_client_impl(
Box::new(os_input),
opts,
config,
config_options,
ClientInfo::New(session_name, layout_info, new_session_cwd, None),
None,
... |
rust_dataset_chunk_511416 | rust_dataset.txt | 511,416 | 512 | before the rest of the
// function happens
process::exit(0);
}
let session_name = generate_unique_session_name_or_exit();
start_client_plan(session_name.clone());
reconnect_to_session = start_client_impl(
... |
rust_dataset_chunk_511417 | rust_dataset.txt | 511,417 | 512 | watcher client
start_client_impl(
Box::new(os_input),
opts,
config,
config_options,
client_info,
None, // tab_position_to_focus
None, // pane_id_to_focus
false, // is_a_reconnect
false, // should_create_detached
None,
);
}
fn re... |
rust_dataset_chunk_511418 | rust_dataset.txt | 511,418 | 512 | ) fn starting_folder(
current: &Path,
program_dir: Option<&Path>,
home: Option<&Path>,
) -> Option<PathBuf> {
let started_where_nobody_works =
same_dir(current, Path::new("/")) || program_dir.is_some_and(|dir| same_dir(current, dir));
if started_where_nobody_works {
home.map(Path::to... |
rust_dataset_chunk_511419 | rust_dataset.txt | 511,419 | 512 | env::current_dir().ok()?;
let program = std::env::current_exe().ok();
terminal_args.working_directory = starting_folder(
¤t,
program.as_deref().and_then(Path::parent),
std::env::home_dir().as_deref(),
);
// The session server, and the plugins it ... |
rust_dataset_chunk_511420 | rust_dataset.txt | 511,420 | 512 | {
over_ssh: true,
..double_click(Platform::MacOs)
},
] {
assert!(!opens_window(case), "{:?}", case);
}
}
#[test]
fn the_session_starts_at_home_when_started_in_the_programs_folder_or_root() {
let program_dir = Path::new("/opt/z... |
rust_dataset_chunk_511421 | rust_dataset.txt | 511,421 | 512 | &CliArgs) -> Option<&std::path::Path> {
match opts.command.as_ref() {
Some(Command::Terminal(TerminalArgs {
socket_dir: Some(socket_dir),
..
})) => Some(socket_dir.as_path()),
_ => None,
}
}
fn main() {
#[cfg(target_os = "macos")]
let login_environment_p... |
rust_dataset_chunk_511422 | rust_dataset.txt | 511,422 | 512 | _success,
block_until_exit_failure,
block_until_exit,
near_current_pane,
no_focus,
borderless,
border_style,
tab_id,
})) = opts.command
{
let cwd = cwd.or_else(|| std::env::current_dir().ok());
le... |
rust_dataset_chunk_511423 | rust_dataset.txt | 511,423 | 512 | y,
width,
height,
pinned,
stacked,
blocking,
block_until_exit_success: false,
block_until_exit_failure: false,
block_until_exit: false,
unblock_condition,
... |
rust_dataset_chunk_511424 | rust_dataset.txt | 511,424 | 512 | essions::ListSessions {
no_formatting,
short,
reverse,
})) = opts.command
{
commands::list_sessions(no_formatting, short, reverse);
} else if let Some(Command::Sessions(Sessions::ListAliases)) = opts.command {
commands::list_aliases(opts);
} else if let Some(Comma... |
rust_dataset_chunk_511425 | rust_dataset.txt | 511,425 | 512 | Some(session_name), config);
} else {
commands::start_client(opts);
}
} else if let Some(layout_for_new_session) = &opts.new_session_with_layout {
let mut opts = opts.clone();
opts.new_session_with_layout = None;
opts.layout = Some(layout_for_new_session.clone())... |
rust_dataset_chunk_511426 | rust_dataset.txt | 511,426 | 512 | Created token successfully");
println!("");
println!("{}", token_and_name);
},
Err(e) => {
eprintln!("Failed to create token: {}", e);
std::process::exit(2)
},
}
} else if ... |
rust_dataset_chunk_511427 | rust_dataset.txt | 511,427 | 512 | until that one is quit, because macOS only allows them
//! for the signed binary inside the app.
use std::ffi::OsString;
use std::os::unix::ffi::OsStrExt;
use std::path::{Path, PathBuf};
use std::process::{Command, Stdio};
use std::sync::atomic::{AtomicUsize, Ordering};
use std::time::{Duration, Instant};
use zellij... |
rust_dataset_chunk_511428 | rust_dataset.txt | 511,428 | 512 | env::set_var("LANG", lang);
}
problem
}
fn needs_a_locale(get: impl Fn(&str) -> Option<OsString>) -> bool {
["LANG", "LC_ALL", "LC_CTYPE"]
.iter()
.all(|key| get(key).map(|value| value.is_empty()).unwrap_or(true))
}
// The language and region from System Settings, e.g. `de_DE` or `en_US@rg... |
rust_dataset_chunk_511429 | rust_dataset.txt | 511,429 | 512 | let status = loop {
match child.try_wait() {
Ok(Some(status)) => break status,
Ok(None) if Instant::now() < deadline => std::thread::sleep(Duration::from_millis(10)),
Ok(None) => {
let _ = child.kill();
let _ = child.wait();
... |
rust_dataset_chunk_511430 | rust_dataset.txt | 511,430 | 512 | ();
path
}
fn pair(key: &str, value: &str) -> (OsString, OsString) {
(OsString::from(key), OsString::from(value))
}
#[test]
fn a_locale_is_needed_only_when_none_is_set() {
let set = |pairs: &[(&str, &str)]| {
let pairs: Vec<(String, String)> = pairs
... |
rust_dataset_chunk_511431 | rust_dataset.txt | 511,431 | 512 | parse_env_reads_every_entry() {
assert_eq!(
parse_env(b"A=1\0B=two\nlines\0C=x=y\0"),
Ok(vec![
pair("A", "1"),
pair("B", "two\nlines"),
pair("C", "x=y")
])
);
}
#[test]
fn parse_env_drops_what_belongs_to_th... |
rust_dataset_chunk_511432 | rust_dataset.txt | 511,432 | 512 | #[test]
fn a_login_shell_that_hangs_is_given_up_on() {
let dir = tempfile::TempDir::new().unwrap();
let shell = fake_shell(&dir, "exec sleep 30");
let started = Instant::now();
let failure = login_environment(&shell, Duration::from_millis(300)).unwrap_err();
assert!(started.... |
rust_dataset_chunk_511433 | rust_dataset.txt | 511,433 | 512 | zellij_utils::cli::{AttachArgs, CliArgs, Command, Sessions, TerminalArgs};
const CLI_PARSE_TEST_STACK_SIZE: usize = 16 * 1024 * 1024;
fn on_large_stack<T: Send + 'static>(f: impl FnOnce() -> T + Send + 'static) -> T {
std::thread::Builder::new()
.stack_size(CLI_PARSE_TEST_STACK_SIZE)
.spawn(f)
... |
rust_dataset_chunk_511434 | rust_dataset.txt | 511,434 | 512 | _fails() {
let args = try_parse(&["zellij", "web", "--timeout", "5"]);
assert!(args.is_err());
}
#[test]
fn web_cli_status_with_start_fails() {
let args = try_parse(&["zellij", "web", "--status", "--start"]);
assert!(args.is_err());
}
#[test]
fn web_cli_status_with_stop_fails() {
let args = try_pa... |
rust_dataset_chunk_511435 | rust_dataset.txt | 511,435 | 512 | = vec!["zellij", "attach"];
args.extend_from_slice(argv);
match try_parse(&args).map(|parsed| parsed.command) {
Ok(Some(Command::Sessions(Sessions::Attach { args, .. }))) => args,
other => panic!("expected an attach command, got {:?}", other),
}
}
fn terminal_args(argv: &[&str]) -> Termina... |
rust_dataset_chunk_511436 | rust_dataset.txt | 511,436 | 512 | _the_way_terminal_emulators_do() {
let args = terminal_args(&["-e", "vim", "-u", "NONE", "--clean", "file.txt"]);
assert_eq!(
args.execute,
vec!["vim", "-u", "NONE", "--clean", "file.txt"]
);
assert_eq!(
args.command(),
&["vim", "-u", "NONE", "--clean", "file.txt"]
);... |
rust_dataset_chunk_511437 | rust_dataset.txt | 511,437 | 512 | "]).watch);
assert!(try_parse(&["zellij", "attach", "--watch", "my-session"]).is_err());
}
#[test]
fn watching_refuses_the_flags_that_would_change_the_session_it_follows() {
for argv in [
vec!["--watch", "--create", "my-session"],
vec!["--watch", "--force-run-commands", "my-session"],
v... |
rust_dataset_chunk_511438 | rust_dataset.txt | 511,438 | 512 | commands(clap::Command::new("zellij"))
.render_long_help()
.to_string()
});
assert!(
help.contains("Open a session in the Zellij terminal, without another terminal emulator"),
"{}",
help
);
}
#[test]
fn the_window_can_toggle_one_panel_of_the_desktop_app() {
... |
rust_dataset_chunk_511439 | rust_dataset.txt | 511,439 | 512 | -app-{}-{:?}",
std::process::id(),
std::thread::current().id()
));
std::fs::create_dir_all(&dir).unwrap();
let socket = dir.join(zellij_utils::consts::APP_CONTROL_SOCKET_NAME);
let _ = std::fs::remove_file(&socket);
let listener = zellij_utils::consts::ipc_bind(&socket).unwrap();
... |
rust_dataset_chunk_511440 | rust_dataset.txt | 511,440 | 512 | command: Some(Command::Action(action)),
..
}) => *action,
other => panic!("{:?} did not parse as an action: {:?}", args, other),
}
}
#[test]
fn the_attention_actions_parse_from_the_command_line() {
use zellij_utils::cli::CliAction;
assert!(matches!(
parse_act... |
rust_dataset_chunk_511441 | rust_dataset.txt | 511,441 | 512 | ));
assert!(matches!(
parse_action(&["toggle-tray-icon"]),
CliAction::ToggleTrayIcon
));
}
#[test]
fn new_panes_and_runs_can_be_watched_with_notify() {
use zellij_utils::cli::CliAction;
assert!(matches!(
parse_action(&["new-pane", "--notify", "--", "make"]),
CliActio... |
rust_dataset_chunk_511442 | rust_dataset.txt | 511,442 | 512 | ",
"--install-desktop-entry",
"--dump-config"
])
.is_err());
assert!(try_parse(&["zellij", "setup", "--make-default-terminal", "--check"]).is_err());
assert!(try_parse(&["zellij", "setup", "--replace-existing"]).is_err());
}
--- FILE: zellij/src/tests/e2e/cases.rs ---
/*
*
* NOTE: Th... |
rust_dataset_chunk_511443 | rust_dataset.txt | 511,443 | 512 | ] = [37]; // %
pub const TOGGLE_ACTIVE_TERMINAL_FULLSCREEN_IN_PANE_MODE: [u8; 1] = [102]; // f
pub const TOGGLE_FLOATING_PANES: [u8; 1] = [119]; // w
pub const CLOSE_PANE_IN_PANE_MODE: [u8; 1] = [120]; // x
pub const MOVE_FOCUS_DOWN_IN_PANE_MODE: [u8; 1] = [106]; // j
pub const MOVE_FOCUS_UP_IN_PANE_MODE: [u8; 1] = [10... |
rust_dataset_chunk_511444 | rust_dataset.txt | 511,444 | 512 | = [108]; // l
pub const SWITCH_PREV_TAB_IN_TAB_MODE: [u8; 1] = [104]; // h
pub const CLOSE_TAB_IN_TAB_MODE: [u8; 1] = [120]; // x
pub const RENAME_TAB_MODE: [u8; 1] = [114]; // r
pub const MOVE_TAB_LEFT: [u8; 2] = [27, 105]; // Alt + i
pub const MOVE_TAB_RIGHT: [u8; 2] = [27, 111]; // Alt + o
pub const SESSION_MODE:... |
rust_dataset_chunk_511445 | rust_dataset.txt | 511,445 | 512 | snapshots for the
// trailing spaces that we had to get rid of here)
let base_replace = Regex::new(r"Alt <\[\]> BASE \s*\n").unwrap();
let base_replace_tmux_mode_1 = Regex::new(r"Alt \[\|SPACE\|Alt \] BASE \s*\n").unwrap();
let base_replace_tmux_mode_2 = Regex::new(r"Alt \[\|Alt \]\|SPACE BASE ... |
rust_dataset_chunk_511446 | rust_dataset.txt | 511,446 | 512 | ignore]
pub fn typing_exit_closes_pane() {
let fake_win_size = Size {
cols: 120,
rows: 24,
};
let mut test_attempts = 10;
let last_snapshot = loop {
RemoteRunner::kill_running_sessions(fake_win_size);
let mut runner = RemoteRunner::new(fake_win_size)
.add_step... |
rust_dataset_chunk_511447 | rust_dataset.txt | 511,447 | 512 | _complete
},
});
if runner.test_timed_out && test_attempts > 0 {
test_attempts -= 1;
continue;
} else {
break last_snapshot;
}
};
let last_snapshot = account_for_races_in_snapshot(last_snapshot);
assert_snapshot!(last_snapshot);... |
rust_dataset_chunk_511448 | rust_dataset.txt | 511,448 | 512 | runner.test_timed_out && test_attempts > 0 {
test_attempts -= 1;
continue;
} else {
break last_snapshot;
}
};
let last_snapshot = account_for_races_in_snapshot(last_snapshot);
assert_snapshot!(last_snapshot);
}
#[test]
#[ignore]
pub fn quit_and_resurrect... |
rust_dataset_chunk_511449 | rust_dataset.txt | 511,449 | 512 | a blocking command through the cli with --blocking --floating --close-on-exit
// - the command sleeps for 2 seconds (longer than the default 1s timeout) then exits with status 42
// - verify that the CLI blocks for the full duration (we check after 2+ seconds)
// - verify that the floating pane appears whi... |
rust_dataset_chunk_511450 | rust_dataset.txt | 511,450 | 512 | illis(2000)); // wait for
// command to
// end
step_is_complete = true
}
step_is_complet... |
rust_dataset_chunk_511451 | rust_dataset.txt | 511,451 | 512 | HashMap;
use std::sync::atomic::{AtomicBool, Ordering};
use std::sync::{Arc, Mutex};
use zellij_server::panes::kitty_graphics::KittyImageStore;
use zellij_server::panes::sixel::SixelImageStore;
use zellij_server::panes::{LinkHandler, TerminalPane};
use zellij_utils::data::{Palette, Style};
use zellij_utils::pane_size:... |
rust_dataset_chunk_511452 | rust_dataset.txt | 511,452 | 512 | /tmp | grep status-bar-tips | xargs rm\n")
.unwrap();
channel.write_all(b"killall -KILL zellij\n").unwrap();
channel.write_all(b"rm -rf /tmp/*\n").unwrap(); // remove temporary artifacts from previous
// tests
channel.write_all(b"rm -rf /tmp/*\n")... |
rust_dataset_chunk_511453 | rust_dataset.txt | 511,453 | 512 | _DATA_DIR,
format!("{}/{}", ZELLIJ_FIXTURE_PATH, layout_file_name)
)
.as_bytes(),
)
.unwrap();
channel.flush().unwrap();
}
fn wait_for_startup(last_snapshot: &Arc<Mutex<String>>) {
let start = std::time::Instant::now();
let timeout = std::time::Durati... |
rust_dataset_chunk_511454 | rust_dataset.txt | 511,454 | 512 | let mut should_sleep = false;
let mut vte_parser = zellij_server::vt_parser::Parser::new();
let character_cell_size = Rc::new(RefCell::new(Some(SizeInPixels {
height: 21,
width: 8,
})));
let sixel_ima... |
rust_dataset_chunk_511455 | rust_dataset.txt | 511,455 | 512 | _)| (x, y))
.unwrap_or((0, 0));
*last_snapshot = current_snapshot;
should_sleep = true;
},
Err(e) => {
if e.kind() == std::io::ErrorKind::WouldBlock {
... |
rust_dataset_chunk_511456 | rust_dataset.txt | 511,456 | 512 | : usize) -> bool {
x == self.cursor_x && y == self.cursor_y
}
pub fn status_bar_appears(&self) -> bool {
self.last_snapshot.lock().unwrap().contains("Ctrl +")
&& self.last_snapshot.lock().unwrap().contains("LOCK")
}
pub fn ctrl_plus_appears(&self) -> bool {
self.last_... |
rust_dataset_chunk_511457 | rust_dataset.txt | 511,457 | 512 | from_secs(1)); // wait until Zellij stops parsing startup ANSI codes from the terminal STDIN
}
pub fn send_blocking_command_through_the_cli(&mut self, command: &str) {
let mut channel = self.channel.lock().unwrap();
channel
.write_all(
format!(
"{}... |
rust_dataset_chunk_511458 | rust_dataset.txt | 511,458 | 512 | _ms: 100,
test_timed_out: false,
last_snapshot,
cursor_coordinates,
reader_thread,
}
}
pub fn new_mirrored_session_with_layout(win_size: Size, layout_file_name: &str) -> Self {
let sess = ssh_connect();
let mut channel = sess.channel_sessio... |
rust_dataset_chunk_511459 | rust_dataset.txt | 511,459 | 512 | run_next_step(&mut self) {
if let Some(next_step) = self.steps.get(self.current_step_index) {
println!(
"running step: {}, retries left: {}",
next_step.name, self.retries_left
);
let (cursor_x, cursor_y) = *self.cursor_coordinates.lock().unwra... |
rust_dataset_chunk_511460 | rust_dataset.txt | 511,460 | 512 | ().unwrap().close();
let reader_thread_running = &mut self.reader_thread.0;
reader_thread_running.store(false, Ordering::SeqCst);
}
}
--- FILE: zellij/src/tests/mod.rs ---
pub mod cli;
pub mod e2e;
--- FILE: zellij/xtask/src/assets.rs ---
//! Deterministic bundling of the web client frontend ass... |
rust_dataset_chunk_511461 | rust_dataset.txt | 511,461 | 512 | !(
"'{}' is out of date, run `cargo xtask assets`",
path.display()
));
}
}
return Ok(());
}
for (name, contents) in &generated {
let path = assets_dir.join(name);
std::fs::write(&path, contents)
.wit... |
rust_dataset_chunk_511462 | rust_dataset.txt | 511,462 | 512 | !(
"duplicate top-level identifier '{}' declared in both '{}.js' and '{}.js'",
name,
previous,
module
));
}
}
bundle.push_str(&chunk);
if !bundle.ends_with('\n') {
bundle.push(... |
rust_dataset_chunk_511463 | rust_dataset.txt | 511,463 | 512 | (line);
out.push('\n');
}
Ok(out)
}
fn is_terminated_import(rest: &str) -> bool {
rest.ends_with(';') && rest.contains(" from ")
}
fn is_import_binding_line(trimmed: &str) -> bool {
if trimmed.is_empty() || trimmed == "{" {
return true;
}
trimmed
.trim_end_matches(',')... |
rust_dataset_chunk_511464 | rust_dataset.txt | 511,464 | 512 | 64] = b"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
let mut out = String::with_capacity(input.len().div_ceil(3) * 4);
for chunk in input.chunks(3) {
let b0 = chunk[0] as u32;
let b1 = *chunk.get(1).unwrap_or(&0) as u32;
let b2 = *chunk.get(2).unwrap_or(&0) as u32;
... |
rust_dataset_chunk_511465 | rust_dataset.txt | 511,465 | 512 | }
}
}
None
}
fn replace_integrity_value(line: &str, digest: &str) -> Option<String> {
let start = line.find("integrity=\"")? + "integrity=\"".len();
let end = start + line[start..].find('"')?;
let mut out = String::with_capacity(line.len() + digest.len());
out.push_str(&line... |
rust_dataset_chunk_511466 | rust_dataset.txt | 511,466 | 512 | ").is_err());
}
#[test]
fn duplicate_top_level_identifiers_are_detected() {
let dir = std::env::temp_dir().join("zellij-xtask-assets-duplicate-test");
let _ = std::fs::remove_dir_all(&dir);
std::fs::create_dir_all(&dir).expect("create temp dir");
for module in MODULE_ORDER {... |
rust_dataset_chunk_511467 | rust_dataset.txt | 511,467 | 512 | //! - [`build`]: Builds general cargo projects (i.e. zellij components) with `cargo build`
use crate::{flags, metadata, WorkspaceMember};
use anyhow::Context;
use std::path::{Path, PathBuf};
use xshell::{cmd, Shell};
/// Build members of the zellij workspace.
///
/// Build behavior is controlled by the [`flags`](flags... |
rust_dataset_chunk_511468 | rust_dataset.txt | 511,468 | 512 | unchanged since last build, skipping (set ZELLIJ_FORCE_PLUGINS=1 to rebuild)";
crate::status(msg);
eprintln!("{}", msg);
}
// Build non-plugin crates (native target).
if !flags.plugins_only {
for WorkspaceMember { crate_name, .. } in crate::workspace_members()
.iter()
... |
rust_dataset_chunk_511469 | rust_dataset.txt | 511,469 | 512 | ).ok()?;
let mut newest: Option<std::time::SystemTime> = None;
for entry in entries.flatten() {
let path = entry.path();
let file_type = match entry.file_type() {
Ok(file_type) => file_type,
Err(_) => continue,
};
if file_type.is_dir() {
if pat... |
rust_dataset_chunk_511470 | rust_dataset.txt | 511,470 | 512 | &WorkspaceMember],
) -> anyhow::Result<()> {
let cargo = crate::cargo()?;
let mut base_cmd = cmd!(sh, "{cargo} build --target wasm32-wasip1 --release");
for member in plugin_members {
let plugin_name = plugin_name_of(member)?;
base_cmd = base_cmd.args(["-p", plugin_name]);
}
base_cmd... |
rust_dataset_chunk_511471 | rust_dataset.txt | 511,471 | 512 | st_nested_session",
"src/nested_session_contract",
"generated_nested_session_api.rs",
),
];
for (out_subdir, src_subdir, include_file) in specs {
let out_dir = sh.current_dir().join(out_subdir);
let src_dir = sh.current_dir().join(src_subdir);
std::fs::cr... |
rust_dataset_chunk_511472 | rust_dataset.txt | 511,472 | 512 | _path();
sh.copy_file(from, to).with_context(err_context)
}
--- FILE: zellij/xtask/src/ci.rs ---
//! Tasks related to zellij CI
use crate::{
assets, build,
flags::{self, BuildRelease, CiCmd, Cross, E2e},
metadata,
};
use anyhow::Context;
use std::{
ffi::OsString,
path::{Path, PathBuf},
};
use ... |
rust_dataset_chunk_511473 | rust_dataset.txt | 511,473 | 512 | .filter_map(|dir_entry| {
if let Ok(entry) = dir_entry {
entry
.file_name()
.to_string_lossy()
.ends_with(".wasm")
.then_some(entry.path())
} else {
None
}
})
... |
rust_dataset_chunk_511474 | rust_dataset.txt | 511,474 | 512 | ()
.map_err(anyhow::Error::new)
})
.context(err_context)
} else {
crate::cargo()
.and_then(|cargo| {
cmd!(
sh,
"{cargo} build --release --target x86_64-unknown-linux-musl"
)
... |
rust_dataset_chunk_511475 | rust_dataset.txt | 511,475 | 512 | test binary gets built with the plugins from assets/plugins that just got built
crate::cargo()
.and_then(|cargo| {
// e2e tests
cmd!(
sh,
"{cargo} test --no-default-features -- --ignored --nocapture --test-threads 1"
)
.args(ar... |
rust_dataset_chunk_511476 | rust_dataset.txt | 511,476 | 512 | ::project_root());
let mut command = if with_zig {
let cargo = crate::cargo().with_context(err_context)?;
let mut zig_target = target.clone();
zig_target.push(".");
zig_target.push(OLDEST_GLIBC);
cmd!(
sh,
"{cargo} zigbuild --verbose --release --target... |
rust_dataset_chunk_511477 | rust_dataset.txt | 511,477 | 512 | ! {
src "./src/flags.rs"
/// Custom build commands for zellij
cmd xtask {
/// Deprecation warning. Compatibility to transition from `cargo make`.
cmd deprecated {
repeated _args: OsString
}
/// Tasks for the CI
cmd ci {
/// end-to-end tests
... |
rust_dataset_chunk_511478 | rust_dataset.txt | 511,478 | 512 | repeated args: OsString
}
/// Run debug version of zellij
cmd run {
/// Take plugins from asset folder, skip building plugins.
optional --quick-run
/// Take plugins from here, skip building plugins. Passed to zellij verbatim
optional -... |
rust_dataset_chunk_511479 | rust_dataset.txt | 511,479 | 512 | i),
Proto(Proto),
Assets(Assets),
Publish(Publish),
Make(Make),
Install(Install),
Run(Run),
Format(Format),
Test(Test),
IntegrationTest(IntegrationTest),
Build(Build),
}
#[derive(Debug)]
pub struct Deprecated {
pub _args: Vec<OsString>,
}
#[derive(Debug)]
pub struct Ci {
... |
rust_dataset_chunk_511480 | rust_dataset.txt | 511,480 | 512 | _or_exit() -> Self {
Self::from_env_or_exit_()
}
#[allow(dead_code)]
pub fn from_env() -> xflags::Result<Self> {
Self::from_env_()
}
#[allow(dead_code)]
pub fn from_vec(args: Vec<std::ffi::OsString>) -> xflags::Result<Self> {
Self::from_vec_(args)
}
}
// generated e... |
rust_dataset_chunk_511481 | rust_dataset.txt | 511,481 | 512 | _context)?;
let profile = if flags.no_opt { "dev" } else { "dev-opt" };
if desktop_tests_wanted(&flags.args) {
let msg = ">> Building the zellij executable for the desktop app tests";
crate::status(msg);
println!("{}", msg);
let features = DESKTOP_BINARY_FEATURES;
cmd!(... |
rust_dataset_chunk_511482 | rust_dataset.txt | 511,482 | 512 | !binary({})", DESKTOP_TESTS))
});
can_run && (selected || !args.iter().any(|arg| arg == "--test")) && !excluded
}
fn xvfb_installed() -> bool {
std::env::var_os("PATH")
.map(|paths| std::env::split_paths(&paths).any(|dir| dir.join("Xvfb").is_file()))
.unwrap_or(false)
}
#[cfg(test)]
mod te... |
rust_dataset_chunk_511483 | rust_dataset.txt | 511,483 | 512 | ifacts: &'static [&'static str],
}
fn workspace_members() -> &'static Vec<WorkspaceMember> {
static WORKSPACE_MEMBERS: OnceLock<Vec<WorkspaceMember>> = OnceLock::new();
WORKSPACE_MEMBERS.get_or_init(|| {
vec![
WorkspaceMember {
crate_name: "default-plugins/bars",
... |
rust_dataset_chunk_511484 | rust_dataset.txt | 511,484 | 512 | {
crate_name: "zellij-server",
build: false,
extra_artifacts: &[],
},
WorkspaceMember {
crate_name: "zellij-terminal",
build: false,
extra_artifacts: &[],
},
WorkspaceMember {... |
rust_dataset_chunk_511485 | rust_dataset.txt | 511,485 | 512 | {
match env::var_os("CARGO_TARGET_DIR") {
Some(dir) => PathBuf::from(dir),
None => crate::project_root().join("target"),
}
}
pub fn cargo() -> anyhow::Result<PathBuf> {
std::env::var_os("CARGO")
.map_or_else(|| which::which("cargo"), |exe| Ok(PathBuf::from(exe)))
.context("... |
rust_dataset_chunk_511486 | rust_dataset.txt | 511,486 | 512 | --no-deps")
.read()
.context("Failed to run cargo metadata")?;
serde_json::from_str(&metadata_json).context("Failed to parse cargo metadata JSON")
}
pub const WEB_FEATURE: &str = "web_server_capability";
pub const TERMINAL_FEATURE: &str = "terminal";
/// Get the appropriate features string for a... |
rust_dataset_chunk_511487 | rust_dataset.txt | 511,487 | 512 | <String> = features.keys().cloned().collect();
return Ok(applicable_features(
&main_default_features,
&crate_features,
excluded,
));
}
}
Ok(None)
}
fn applicable_features(
main_default_features: &[String],
crate_features:... |
rust_dataset_chunk_511488 | rust_dataset.txt | 511,488 | 512 | ())
);
}
fn metadata() -> Value {
serde_json::json!({
"packages": [
{
"name": "zellij",
"features": {
"default": ["plugins_from_target", "vendored_curl", WEB_FEATURE, TERMINAL_FEATURE],
... |
rust_dataset_chunk_511489 | rust_dataset.txt | 511,489 | 512 | test};
use crate::{flags, WorkspaceMember};
use anyhow::Context;
use xshell::{cmd, Shell};
/// Perform a default build.
///
/// Runs the following steps in sequence:
///
/// - format
/// - build
/// - test
pub fn make(sh: &Shell, flags: flags::Make) -> anyhow::Result<()> {
let err_context = || format!("failed to ... |
rust_dataset_chunk_511490 | rust_dataset.txt | 511,490 | 512 | flags.destination.clone()
} else {
std::env::current_dir()
.context("Can't determine current working directory")?
.join(&flags.destination)
};
sh.change_dir(crate::project_root());
sh.copy_file(
crate::target_dir().join("release").join("zellij"),
&... |
rust_dataset_chunk_511491 | rust_dataset.txt | 511,491 | 512 | ")
.context("Failed to check web features for main crate")?
{
Some(features) => {
let mut cmd = cmd!(sh, "{cargo} run").args(["--no-default-features"]);
if !features.is_empty() {
cmd = cm... |
rust_dataset_chunk_511492 | rust_dataset.txt | 511,492 | 512 | )?;
let project_dir = crate::project_root();
let manifest = sh
.read_file(project_dir.join("Cargo.toml"))
.context(err_context)?
.parse::<toml::Table>()
.context(err_context)?;
// Version of the core crate
let version = manifest
.get("workspace")
.and_then... |
rust_dataset_chunk_511493 | rust_dataset.txt | 511,493 | 512 | .run()
.context(err_context)?;
// Tag release
cmd!(sh, "git tag --annotate --message")
.arg(format!("Version {}", version))
.arg(format!("v{}", version))
.run()
.context(err_context)?;
}
let closure = || -> anyhow::Result<... |
rust_dataset_chunk_511494 | rust_dataset.txt | 511,494 | 512 | " | "I" => {
action = UserAction::Ignore;
break;
},
_ => {
println!(" --> Unknown input '{buffer}', ignoring...");
println!();
... |
rust_dataset_chunk_511495 | rust_dataset.txt | 511,495 | 512 | ()
.filter(|m| m.crate_name.contains("plugins"))
.map(|m| m.crate_name.rsplit_once('/').unwrap().1)
.collect();
if !plugin_names.is_empty() {
println!();
let msg = ">> Testing plugins";
crate::status(msg);
println!("{}", msg);
... |
rust_dataset_chunk_511496 | rust_dataset.txt | 511,496 | 512 | check_feature_is_optional(sh, &cargo, &excluded, metadata::WEB_FEATURE)
.context(err_context)?;
}
Ok(())
}
fn check_feature_is_optional(
sh: &Shell,
cargo: &std::path::PathBuf,
already_excluded: &[&str],
feature: &str,
) -> anyhow::Result<()> {
let mut excluded = alread... |
rust_dataset_chunk_511497 | rust_dataset.txt | 511,497 | 512 | , HashSet, VecDeque};
use std::io::{self, BufRead, Read, Write};
use std::process;
use std::str::FromStr;
use std::{fs, path::PathBuf};
use crate::os_input_output::ClientOsApi;
use uuid::Uuid;
use zellij_utils::{
cli::{EventsCli, PromptCli, PromptElementCli, SubscribeCli, SubscribeFormat},
data::{OutsideClick,... |
rust_dataset_chunk_511498 | rust_dataset.txt | 511,498 | 512 | _no_focus,
popup_capture_all_keys,
popup_outside_click,
},
payload,
);
if exit_status != 0 {
os_input.send_to_server(ClientToServerMsg::ClientExited);
return ex... |
rust_dataset_chunk_511499 | rust_dataset.txt | 511,499 | 512 | _id,
client_id: None,
is_cli_client: true,
}
}
}
enum PipeWaitOutcome {
Released(Option<i32>),
Exit(i32),
}
fn handle_pipe_server_message(
os_input: &mut Box<dyn ClientOsApi>,
pipe_id: &str,
message: ServerToClientMsg,
) -> Option<PipeWaitOutcome> {
match me... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.