Skip to content

Commit

Permalink
Added Time for Init and Commit
Browse files Browse the repository at this point in the history
  • Loading branch information
shubhexists committed Dec 19, 2023
1 parent 828a78f commit 46fb294
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 1 deletion.
2 changes: 2 additions & 0 deletions src/commands/init.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
use chrono::Utc;
//This will have an init function which will currently create a .vault folder in the current directory
// VAULT INIT
use crate::commands::{create::create, switch::switch};
Expand Down Expand Up @@ -25,6 +26,7 @@ pub fn init() {

fn get_init_data() -> String {
let yaml_struct: InitLayout = InitLayout {
created_at: Utc::now().to_string(),
current_branch: String::new(),
branches: Vec::new(),
};
Expand Down
Empty file added src/commands/log.rs
Empty file.
2 changes: 1 addition & 1 deletion src/commands/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ pub mod init;
pub mod switch;
pub mod cat;
pub mod delete;

pub mod log;
4 changes: 4 additions & 0 deletions src/utils/yaml_layouts.rs
Original file line number Diff line number Diff line change
@@ -1,15 +1,18 @@
use super::get_current_branch::get_current_branch;
use chrono::Utc;
use serde::{Deserialize, Serialize};
use std::{fs, io, path::Path};

#[derive(Serialize, Deserialize, PartialEq, Debug)]
pub struct InitLayout {
pub created_at: String,
pub current_branch: String,
pub branches: Vec<String>,
}

#[derive(Serialize, Deserialize, PartialEq, Debug)]
pub struct ConfigLayout {
created_at: String,
head: String,
commits: Vec<Commit>,
}
Expand All @@ -28,6 +31,7 @@ struct Hash {
impl Default for ConfigLayout {
fn default() -> Self {
ConfigLayout {
created_at: Utc::now().to_string(),
head: String::new(),
commits: Vec::new(),
}
Expand Down

0 comments on commit 46fb294

Please sign in to comment.