gz-fuel 0.1.0

Tools for interacting with the gz-fuel model repository
Documentation
/*
 * Copyright (C) 2024 Open Source Robotics Foundation
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
*/

use gz_fuel::FuelClient;
use std::time::Duration;

fn main() {
    let mut client = FuelClient::default();
    println!("Checking if the fuel cache needs to be updated");
    if let Some(path) = client.cache_path.as_ref().and_then(|path| path.to_str()) {
        println!(" -- path: {path}");
    }
    let should_update = client.should_update_cache(&Some(Duration::from_secs(100000)));
    if should_update {
        println!("Updating cache...");
        client.update_cache_blocking(true);
    } else {
        println!("No cache update needed");
    }
}