Skip to content

Commit ca1ff57

Browse files
committed
feat: add force
1 parent 895ca4b commit ca1ff57

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ This work is licensed under a [Creative Commons Attribution 4.0 International Li
8989
[cc-by-shield]: https://img.shields.io/badge/License-CC%20BY%204.0-lightgrey.svg
9090

9191
- [LICENSE](https://github.com/andreas-timm/code-signature-ts/blob/main/LICENSE)
92-
- Author: Andreas Timm
92+
- Author: [Andreas Timm](https://github.com/andreas-timm)
9393

9494
## Links
9595
[^1]: https://eips.ethereum.org/EIPS/eip-191

src/code-signature.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
// Author: Andreas Timm
66
// Repository: https://github.com/andreas-timm/code-signature-ts
77
// Version: 0.4.0
8-
// @sha256sum 0xe901425d12469ef7e0fdd010e2d158d5398a8a6ae7e1a79bce1f77a6b9d3237b
9-
// @eip191signature 0x3b08f924e994205005312fec95c30e181fb066744ca51a17d122221953cda7e37abec4184e1755385cae7837cea1a6e6f74b3d336484026338bf6d2426e9f9be1c
8+
// @sha256sum 0x004449b7297c9c7332cb590a46ddddd5640fb79912b57f027f77df816b883c5c
9+
// @eip191signature 0x8f23ab609c8c2f00f9ebbd9e0e78d3cb62a273e74ccbe1aa21a0207aa26a76ad2d97333c219e7da1ba3382ed19585bb24d666bceae3e850124f454dd1d1cd2251c
1010

1111
import { parseArgs } from 'util'
1212
import { hashMessage, recoverAddress, sha256 } from 'viem'
@@ -116,6 +116,7 @@ function printHelp() {
116116
console.log('OPTIONS:')
117117
console.log(' --verify, -v — only verify')
118118
console.log(' --write, -w — write file')
119+
console.log(' --force, -f - force write')
119120
console.log(' --silent, -s — silent')
120121
console.log(' --prefix, -p — commented line prefix')
121122
console.log(' --out, -o — output file')
@@ -165,7 +166,7 @@ export async function codeSignature(options: Options) {
165166
signResult = await sign(verifyResult, options)
166167

167168
if (signResult.signedContent !== null) {
168-
if (options.write && fail) {
169+
if (options.write && (fail || options.force)) {
169170
await write(options, signResult.signedContent)
170171
}
171172

@@ -192,6 +193,7 @@ export async function codeSign() {
192193
options: {
193194
help: { type: 'boolean', short: 'h', default: false },
194195
write: { type: 'boolean', short: 'w', default: false },
196+
force: { type: 'boolean', short: 'f', default: false },
195197
verify: { type: 'boolean', short: 'v', default: false },
196198
silent: { type: 'boolean', short: 's', default: false },
197199
prefix: { type: 'string', short: 'p', default: '//' },

0 commit comments

Comments
 (0)