@@ -9,10 +9,84 @@ import (
99// NewScaffoldList returns a new command to scaffold a list. 
1010func  NewScaffoldList () * cobra.Command  {
1111	c  :=  & cobra.Command {
12- 		Use :   "list NAME [field]..." ,
13- 		Short : "CRUD for data stored as an array" ,
14- 		Args :  cobra .MinimumNArgs (1 ),
15- 		RunE :  scaffoldListHandler ,
12+ 		Use : "list NAME [field]..." ,
13+ 		Short : `The "list" scaffolding command is used to generate files that implement the 
14+ logic for storing and interacting with data stored as a list in the blockchain 
15+ state. 
16+ 
17+ The command accepts a NAME argument that will be used as the name of a new type 
18+ of data. It also accepts a list of FIELDs that describe the type. 
19+ 
20+ The interaction with the data follows the create, read, updated, and delete 
21+ (CRUD) pattern. For each type three Cosmos SDK messages are defined for writing 
22+ data to the blockchain: MsgCreate{Name}, MsgUpdate{Name}, MsgDelete{Name}. For 
23+ reading data two queries are defined: {Name} and {Name}All. The type, messages, 
24+ and queries are defined in the "proto/" directory as protocol buffer messages. 
25+ Messages and queries are mounted in the "Msg" and "Query" services respectively. 
26+ 
27+ When messages are handled, the appropriate keeper methods are called. By 
28+ convention, the methods are defined in 
29+ "x/{moduleName}/keeper/msg_server_{name}.go". Helpful methods for getting, 
30+ setting, removing, and appending are defined in the same "keeper" package in 
31+ "{name}.go". 
32+ 
33+ The "list" command essentially allows you to define a new type of data and 
34+ provides the logic to create, read, update, and delete instances of the type. 
35+ For example, let's review a command that generates the code to handle a list of 
36+ posts and each post has "title" and "body" fields: 
37+ 
38+   ignite scaffold list post title body 
39+ 
40+ This provides you with a "Post" type, MsgCreatePost, MsgUpdatePost, 
41+ MsgDeletePost and two queries: Post and PostAll. The compiled CLI, let's say the 
42+ binary is "blogd" and the module is "blog", has commands to query the chain (see 
43+ "blogd q blog") and broadcast transactions with the messages above (see "blogd 
44+ tx blog"). 
45+ 
46+ The code generated with the list command is meant to be edited and tailored to 
47+ your application needs. Consider the code to be a "skeleton" for the actual 
48+ business logic you will implement next. 
49+ 
50+ By default, all fields are assumed to be strings. If you want a field of a 
51+ different type, you can specify it after a colon ":". The following types are 
52+ supported: string, bool, int, uint, coin, array.string, array.int, array.uint, 
53+ array.coin. An example of using custom types: 
54+ 
55+   ignite scaffold list pool amount:coin tags:array.string height:int 
56+    
57+ Ignite also supports custom types: 
58+    
59+   ignite scaffold list product-details name description 
60+    
61+   ignite scaffold list product price:coin details:ProductDetails 
62+ 
63+ In the example above the "ProductDetails" type was defined first, and then used 
64+ as a custom type for the "details" field. Ignite doesn't support arrays of 
65+ custom types yet. 
66+ 
67+ By default the code will be scaffolded in the module that matches your project's 
68+ name. If you have several modules in your project, you might want to specify a 
69+ different module: 
70+ 
71+   ignite scaffold list post title body --module blog 
72+ 
73+ By default, each message comes with a "creator" field that represents the 
74+ address of the transaction signer. You can customize the name of this field with 
75+ a flag: 
76+ 
77+   ignite scaffold list post title body --signer author 
78+ 
79+ It's possible to scaffold just the getter/setter logic without the CRUD 
80+ messages. This is useful when you want the methods to handle a type, but would 
81+ like to scaffold messages manually. Use a flag to skip message scaffolding: 
82+ 
83+   ignite scaffold list post title body --no-message 
84+ 
85+ The "creator" field is not generated if a list is scaffolded with the 
86+ "--no-message" flag. 
87+ ` ,
88+ 		Args : cobra .MinimumNArgs (1 ),
89+ 		RunE : scaffoldListHandler ,
1690	}
1791
1892	flagSetPath (c )
0 commit comments