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
15
16
use crate::ParseResult;
use crate::ast::Instruction;
use crate::error::ParseError;
use crate::parser::utils::clean_exec_form;
use crate::parser::utils::is_exec_form;

pub fn parse(arguments: &[String]) -> ParseResult<Instruction> {
    if !is_exec_form(arguments) {
        return Err(ParseError::SyntaxError(String::from(
            "SHELL requires the arguments to be in JSON form",
        )));
    }

    let shell = clean_exec_form(arguments);
    Ok(Instruction::Shell(shell))
}