dockerfile-parser-rs 3.3.0

The ultimate Rust library for parsing, modifying, and generating Dockerfiles
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
use crate::ParseResult;
use crate::ast::Instruction;
use crate::error::ParseError;

pub fn parse(arguments: &[String]) -> ParseResult<Instruction> {
    if arguments.len() != 1 {
        return Err(ParseError::WrongNumberOfArguments(String::from(
            "STOPSIGNAL requires exactly one argument",
        )));
    }

    let signal = arguments.first().unwrap().to_owned();
    Ok(Instruction::Stopsignal { signal })
}