By Example

Unpack a Contract File

You can list the contents of a .contract file using the CLI and then extract files you want to view:

% contract contents -f example.contract

/collective/name.text     Example Collective
/collective/email.text    admin@example.com
/collective/signing.pub   crypto://ed25519-pub/12D3KooWGzTPmNwRgs6qspk5TmPGrVyHEE8dGq9nTfYBF5Dbf1YK
/agreement.pdf            attachment://decdef816dece1e1aa152e649d1a860757e0b9a7d153d23bc1051858f3db65c1
/README.md                attachment://e1fef8da62c19310d825dda71bcb9e616405545ea1c88898e089449519087241

% contract extract -f example.contract -p /agreement.pdf

But another way to quickly get access to all the files in a .contract is to unpack it and view its content as a directory on your computer:

% contract unpack -f example.contract

Unpacking to: ~/Downloads/example

~/Downloads/example/collective/name.text 
~/Downloads/example/collective/email.text 
~/Downloads/example/collective/signing.pub 
~/Downloads/example/agreement.pdf
~/Downloads/example/README.md
~/Downloads/example/.contract

Unpacking complete!

You can also interact with the unpacked Modality directory using the CLI:

% contract info --directory ~/Downloads/example

# Summary

* Contributors: 1
* Commits: 1
* Rules: 1
* Files: 2
* Values: 3
* Drafts: 1

...

If you change directories into an unpacked Modality directory (or any of its subdirectories), you also don’t need specify its path when using the command line:

% cd ~/Downloads/example
% contract info

# Summary

* Contributors: 1
* Commits: 1
* Rules: 1
* Files: 2
* Values: 3
* Drafts: 1

...

If you make changes to a contract directory, you may want to pack it back up as a .contract file to send to others:

% contract pack -f ~/example2.contract