mirror of
https://github.com/kmc7468/cs220.git
synced 2025-12-12 21:08:45 +00:00
- assignment05/pascal.mlw: lowered the difficulty (one more invariant given) - assignment02, 03: minor fixes & divide into sub-problems
29 lines
1.0 KiB
Rust
29 lines
1.0 KiB
Rust
//! Parsing a shell command.
|
|
//!
|
|
//! Shell commands are text-based instructions that you can enter in a command-line interface (CLI)
|
|
//! to interact with operating systems (e.g. Linux) and others.
|
|
//! For example, you can use the `ls` command to list files in a directory.
|
|
//!
|
|
//! You will parse a given string consists of a small number of shell commands.
|
|
|
|
/// Parse the string as a shell command.
|
|
///
|
|
/// Usually, a shell command is whitespace-separated array of strings.
|
|
/// ```text
|
|
/// cat file --> ["cat", "file"]
|
|
/// ```
|
|
/// But sometimes, you may want to include whitespaces in each argument.
|
|
/// In that case, you can use quotes.
|
|
/// ```text
|
|
/// ls 'VirtualBox VMs' --> ["ls", 'VirtualBox VMs']
|
|
/// ls VirtualBox' 'VMs --> ["ls", 'VirtualBox VMs']
|
|
/// ```
|
|
///
|
|
/// For simplicity, you may assume that the string only contains alphanumeric characters, spaces
|
|
/// (" "), and single quotes ("'").
|
|
///
|
|
/// See `test_shell` for more examples.
|
|
pub fn parse_shell_command(command: &str) -> Vec<String> {
|
|
todo!()
|
|
}
|