Skip to content

Commit 4e7b155

Browse files
committed
adding uuud to Profile
1 parent 8e67744 commit 4e7b155

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

src/Profiles/Profiles.jl

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,17 @@
11
module Profiles
22

3+
4+
using ..Types: CONFIG_DIR
5+
using Base: UUID
6+
37
using Pkg.TOML
48
import Base.Dict
59

10+
11+
612
struct Profile
7-
name::AbstractString
13+
uuid::UUID
14+
name::Union{AbstractString,Nothing}
815
date::Union{AbstractString,Nothing}
916
about::Union{AbstractString,Nothing}
1017
homepage::Union{AbstractString,Nothing}
@@ -17,6 +24,7 @@ end
1724
function Dict(profile::Profile)
1825
dict = Dict()
1926

27+
dict["uuid"] = string(profile.uuid)
2028
isnothing(profile.name) || (dict["name"] = profile.name)
2129
isnothing(profile.date) || (dict["date"] = profile.date)
2230
isnothing(profile.about) || (dict["about"] = profile.about)
@@ -31,7 +39,7 @@ end
3139

3240
### I could use this for the tests with something like Profile(Dict("name"=>"account1"))
3341
function Profile(dict::Dict)
34-
42+
uuid = UUID(dict["uuid"])
3543
haskey(dict,"name") ? (name=dict["name"]) : (name=nothing)
3644
haskey(dict,"date") ? (date=dict["date"]) : (date=nothing)
3745
haskey(dict,"about") ? (about=dict["about"]) : (about=nothing)
@@ -43,7 +51,7 @@ function Profile(dict::Dict)
4351

4452
# One may also add membership of each deme as part of the profile additionally with signatures in a envelope form.
4553

46-
return Profile(name,date,about,homepage,email,facebook,twitter,github)
54+
return Profile(uuid,name,date,about,homepage,email,facebook,twitter,github)
4755
end
4856

4957
function save(fname::AbstractString,profile::Profile)

0 commit comments

Comments
 (0)