1 /* 2 * Copyright (C) 2023 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 #pragma once 18 19 #include <iostream> 20 #include <optional> 21 #include <string> 22 #include <vector> 23 24 #include <android-base/logging.h> 25 26 #include "common/libs/utils/result.h" 27 28 namespace cuttlefish { 29 30 enum class SnapshotCmd : int { 31 kUnknown = 0, 32 kSuspend = 1, 33 kResume = 2, 34 kSnapshotTake = 3, 35 }; 36 37 std::ostream& operator<<(std::ostream& out, const SnapshotCmd& cmd); 38 39 struct Parsed { 40 SnapshotCmd cmd; 41 std::vector<int> instance_nums; 42 int wait_for_launcher; 43 std::string snapshot_path; 44 bool cleanup_snapshot_path; 45 // Delete snapshot_path if already present. 46 bool force = false; 47 // Suspend/resume before/after taking the snapshot. 48 // 49 // Ideally we'd detect the suspended state of CF and do this automatically by 50 // default. 51 bool auto_suspend = false; 52 std::optional<android::base::LogSeverity> verbosity_level; 53 }; 54 Result<Parsed> Parse(int argc, char** argv); 55 Result<Parsed> Parse(std::vector<std::string>& args); 56 57 } // namespace cuttlefish 58