Skip to content

Commit

Permalink
make contract code argument positional and throw error when no code s…
Browse files Browse the repository at this point in the history
…upplied
  • Loading branch information
sam-finch-tezos committed Oct 20, 2023
1 parent fda534f commit 11808d7
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions jstz_cli/src/deploy.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use anyhow::Result;
use anyhow::{anyhow, Result};
use serde_json::json;

use crate::{
Expand All @@ -17,7 +17,7 @@ pub fn exec(
let contract_code = contract_code
.map(from_file_or_id)
.or_else(piped_input)
.unwrap_or(String::default());
.ok_or(anyhow!("No function code supplied"))?;
// Create JSON message
let jmsg = json!({
"DeployContract": {
Expand Down
6 changes: 3 additions & 3 deletions jstz_cli/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,12 @@ enum Command {
/// Address used when deploying the contract
#[arg(short, long)]
self_address: String,
/// Function code.
#[arg(short, long, default_value = None)]
function_code: Option<String>,
/// Initial balance
#[arg(short, long, default_value_t = 0)]
balance: u64,
/// Function code.
#[arg(value_name = "function_code", default_value = None)]
function_code: Option<String>,
},
/// Run a smart function using a specified URL.
Run {
Expand Down

0 comments on commit 11808d7

Please sign in to comment.