File: Command.h

package info (click to toggle)
ausaxs 1.1.8-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 72,592 kB
  • sloc: cpp: 49,853; ansic: 6,901; python: 730; makefile: 18
file content (40 lines) | stat: -rw-r--r-- 805 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
// SPDX-License-Identifier: LGPL-3.0-or-later
// Author: Kristian Lytje

#pragma once

#include <shell/Option.h>

#include <string>

namespace ausaxs::shell {
    struct CommandResult {
        std::string out;
        int exit_code;
    };

    class Command {
        public: 
            Command() noexcept;
            Command(const std::string& cmd);

            void set(const std::string& cmd);

            std::string get() const;

            Command& append(const shell::Argument& arg);

            Command& append(const shell::Flag& flag);

            Command& append(const std::string& arg);

            Command& prepend(const std::string& arg);

            Command& mute();

            CommandResult execute() const;
            
        private: 
            std::string cmd;
    };
}