Fossil SCM
added ticket list and new quoting option to ticket show
Commit
82559a701f6c5fb3ac3c02e8c37312f080c8daf2
Parent
63d91f0b87b0f68…
2 files changed
+64
-28
+33
-5
+64
-28
| --- src/report.c | ||
| +++ src/report.c | ||
| @@ -948,26 +948,48 @@ | ||
| 948 | 948 | /* |
| 949 | 949 | ** user defined separator used by ticket show command |
| 950 | 950 | */ |
| 951 | 951 | static const char *zSep = 0; |
| 952 | 952 | |
| 953 | +/* | |
| 954 | +** select the quoting algorithm for "ticket show" | |
| 955 | +*/ | |
| 956 | +#if INTERFACE | |
| 957 | +typedef enum eTktShowEnc { tktNoTab=0, tktFossilize=1 } tTktShowEncoding; | |
| 958 | +#endif | |
| 959 | +static tTktShowEncoding tktEncode = tktNoTab; | |
| 960 | + | |
| 953 | 961 | /* |
| 954 | 962 | ** Output the text given in the argument. Convert tabs and newlines into |
| 955 | 963 | ** spaces. |
| 956 | 964 | */ |
| 957 | 965 | static void output_no_tabs_file(const char *z){ |
| 958 | - while( z && z[0] ){ | |
| 959 | - int i, j; | |
| 960 | - for(i=0; z[i] && (!isspace(z[i]) || z[i]==' '); i++){} | |
| 961 | - if( i>0 ){ | |
| 962 | - printf("%.*s", i, z); | |
| 963 | - } | |
| 964 | - for(j=i; isspace(z[j]); j++){} | |
| 965 | - if( j>i ){ | |
| 966 | - printf("%*s", j-i, ""); | |
| 967 | - } | |
| 968 | - z += j; | |
| 966 | + switch( tktEncode ){ | |
| 967 | + case tktFossilize: | |
| 968 | + { char *zFosZ; | |
| 969 | + | |
| 970 | + if( z && *z ){ | |
| 971 | + zFosZ = fossilize(z,-1); | |
| 972 | + printf("%s",zFosZ); | |
| 973 | + free(zFosZ); | |
| 974 | + } | |
| 975 | + break; | |
| 976 | + } | |
| 977 | + default: | |
| 978 | + while( z && z[0] ){ | |
| 979 | + int i, j; | |
| 980 | + for(i=0; z[i] && (!isspace(z[i]) || z[i]==' '); i++){} | |
| 981 | + if( i>0 ){ | |
| 982 | + printf("%.*s", i, z); | |
| 983 | + } | |
| 984 | + for(j=i; isspace(z[j]); j++){} | |
| 985 | + if( j>i ){ | |
| 986 | + printf("%*s", j-i, ""); | |
| 987 | + } | |
| 988 | + z += j; | |
| 989 | + } | |
| 990 | + break; | |
| 969 | 991 | } |
| 970 | 992 | } |
| 971 | 993 | |
| 972 | 994 | /* |
| 973 | 995 | ** Output a row as a tab-separated line of text. |
| @@ -998,11 +1020,16 @@ | ||
| 998 | 1020 | /* |
| 999 | 1021 | ** Generate a report. The rn query parameter is the report number. |
| 1000 | 1022 | ** The output is written to stdout as flat file. The zFilter paramater |
| 1001 | 1023 | ** is a full WHERE-condition. |
| 1002 | 1024 | */ |
| 1003 | -void rptshow( const char *zRep, const char *zSep, const char *zFilter ){ | |
| 1025 | +void rptshow( | |
| 1026 | + const char *zRep, | |
| 1027 | + const char *zSepIn, | |
| 1028 | + const char *zFilter, | |
| 1029 | + tTktShowEncoding enc | |
| 1030 | +){ | |
| 1004 | 1031 | Stmt q; |
| 1005 | 1032 | char *zSql; |
| 1006 | 1033 | char *zTitle; |
| 1007 | 1034 | char *zOwner; |
| 1008 | 1035 | char *zClrKey; |
| @@ -1009,34 +1036,43 @@ | ||
| 1009 | 1036 | char *zErr1 = 0; |
| 1010 | 1037 | char *zErr2 = 0; |
| 1011 | 1038 | int count = 0; |
| 1012 | 1039 | int rn; |
| 1013 | 1040 | |
| 1014 | - rn = atoi(zRep); | |
| 1015 | - if( rn ){ | |
| 1016 | - db_prepare(&q, | |
| 1017 | - "SELECT title, sqlcode, owner, cols FROM reportfmt WHERE rn=%d", rn); | |
| 1041 | + if (!zRep) { | |
| 1042 | + zTitle = "tickets"; | |
| 1043 | + zSql = "SELECT * FROM ticket"; | |
| 1044 | + zOwner = (char*)g.zLogin; | |
| 1045 | + zClrKey = ""; | |
| 1018 | 1046 | }else{ |
| 1019 | - db_prepare(&q, | |
| 1020 | - "SELECT title, sqlcode, owner, cols FROM reportfmt WHERE title='%s'", zRep); | |
| 1021 | - } | |
| 1022 | - if( db_step(&q)!=SQLITE_ROW ){ | |
| 1023 | - db_finalize(&q); | |
| 1024 | - fossil_fatal("unkown report format(%s)!",zRep); | |
| 1025 | - } | |
| 1026 | - zTitle = db_column_malloc(&q, 0); | |
| 1027 | - zSql = db_column_malloc(&q, 1); | |
| 1028 | - zOwner = db_column_malloc(&q, 2); | |
| 1029 | - zClrKey = db_column_malloc(&q, 3); | |
| 1030 | - db_finalize(&q); | |
| 1047 | + rn = atoi(zRep); | |
| 1048 | + if( rn ){ | |
| 1049 | + db_prepare(&q, | |
| 1050 | + "SELECT title, sqlcode, owner, cols FROM reportfmt WHERE rn=%d", rn); | |
| 1051 | + }else{ | |
| 1052 | + db_prepare(&q, | |
| 1053 | + "SELECT title, sqlcode, owner, cols FROM reportfmt WHERE title='%s'", zRep); | |
| 1054 | + } | |
| 1055 | + if( db_step(&q)!=SQLITE_ROW ){ | |
| 1056 | + db_finalize(&q); | |
| 1057 | + fossil_fatal("unkown report format(%s)!",zRep); | |
| 1058 | + } | |
| 1059 | + zTitle = db_column_malloc(&q, 0); | |
| 1060 | + zSql = db_column_malloc(&q, 1); | |
| 1061 | + zOwner = db_column_malloc(&q, 2); | |
| 1062 | + zClrKey = db_column_malloc(&q, 3); | |
| 1063 | + db_finalize(&q); | |
| 1064 | + } | |
| 1031 | 1065 | if( zFilter ){ |
| 1032 | 1066 | zSql = mprintf("SELECT * FROM (%s) WHERE %s",zSql,zFilter); |
| 1033 | 1067 | } |
| 1034 | 1068 | count = 0; |
| 1069 | + tktEncode = enc; | |
| 1070 | + zSep = zSepIn; | |
| 1035 | 1071 | sqlite3_set_authorizer(g.db, report_query_authorizer, (void*)&zErr1); |
| 1036 | 1072 | sqlite3_exec(g.db, zSql, output_separated_file, &count, &zErr2); |
| 1037 | 1073 | sqlite3_set_authorizer(g.db, 0, 0); |
| 1038 | 1074 | if( zFilter ){ |
| 1039 | 1075 | free(zSql); |
| 1040 | 1076 | } |
| 1041 | 1077 | } |
| 1042 | 1078 | |
| 1043 | 1079 |
| --- src/report.c | |
| +++ src/report.c | |
| @@ -948,26 +948,48 @@ | |
| 948 | /* |
| 949 | ** user defined separator used by ticket show command |
| 950 | */ |
| 951 | static const char *zSep = 0; |
| 952 | |
| 953 | /* |
| 954 | ** Output the text given in the argument. Convert tabs and newlines into |
| 955 | ** spaces. |
| 956 | */ |
| 957 | static void output_no_tabs_file(const char *z){ |
| 958 | while( z && z[0] ){ |
| 959 | int i, j; |
| 960 | for(i=0; z[i] && (!isspace(z[i]) || z[i]==' '); i++){} |
| 961 | if( i>0 ){ |
| 962 | printf("%.*s", i, z); |
| 963 | } |
| 964 | for(j=i; isspace(z[j]); j++){} |
| 965 | if( j>i ){ |
| 966 | printf("%*s", j-i, ""); |
| 967 | } |
| 968 | z += j; |
| 969 | } |
| 970 | } |
| 971 | |
| 972 | /* |
| 973 | ** Output a row as a tab-separated line of text. |
| @@ -998,11 +1020,16 @@ | |
| 998 | /* |
| 999 | ** Generate a report. The rn query parameter is the report number. |
| 1000 | ** The output is written to stdout as flat file. The zFilter paramater |
| 1001 | ** is a full WHERE-condition. |
| 1002 | */ |
| 1003 | void rptshow( const char *zRep, const char *zSep, const char *zFilter ){ |
| 1004 | Stmt q; |
| 1005 | char *zSql; |
| 1006 | char *zTitle; |
| 1007 | char *zOwner; |
| 1008 | char *zClrKey; |
| @@ -1009,34 +1036,43 @@ | |
| 1009 | char *zErr1 = 0; |
| 1010 | char *zErr2 = 0; |
| 1011 | int count = 0; |
| 1012 | int rn; |
| 1013 | |
| 1014 | rn = atoi(zRep); |
| 1015 | if( rn ){ |
| 1016 | db_prepare(&q, |
| 1017 | "SELECT title, sqlcode, owner, cols FROM reportfmt WHERE rn=%d", rn); |
| 1018 | }else{ |
| 1019 | db_prepare(&q, |
| 1020 | "SELECT title, sqlcode, owner, cols FROM reportfmt WHERE title='%s'", zRep); |
| 1021 | } |
| 1022 | if( db_step(&q)!=SQLITE_ROW ){ |
| 1023 | db_finalize(&q); |
| 1024 | fossil_fatal("unkown report format(%s)!",zRep); |
| 1025 | } |
| 1026 | zTitle = db_column_malloc(&q, 0); |
| 1027 | zSql = db_column_malloc(&q, 1); |
| 1028 | zOwner = db_column_malloc(&q, 2); |
| 1029 | zClrKey = db_column_malloc(&q, 3); |
| 1030 | db_finalize(&q); |
| 1031 | if( zFilter ){ |
| 1032 | zSql = mprintf("SELECT * FROM (%s) WHERE %s",zSql,zFilter); |
| 1033 | } |
| 1034 | count = 0; |
| 1035 | sqlite3_set_authorizer(g.db, report_query_authorizer, (void*)&zErr1); |
| 1036 | sqlite3_exec(g.db, zSql, output_separated_file, &count, &zErr2); |
| 1037 | sqlite3_set_authorizer(g.db, 0, 0); |
| 1038 | if( zFilter ){ |
| 1039 | free(zSql); |
| 1040 | } |
| 1041 | } |
| 1042 | |
| 1043 |
| --- src/report.c | |
| +++ src/report.c | |
| @@ -948,26 +948,48 @@ | |
| 948 | /* |
| 949 | ** user defined separator used by ticket show command |
| 950 | */ |
| 951 | static const char *zSep = 0; |
| 952 | |
| 953 | /* |
| 954 | ** select the quoting algorithm for "ticket show" |
| 955 | */ |
| 956 | #if INTERFACE |
| 957 | typedef enum eTktShowEnc { tktNoTab=0, tktFossilize=1 } tTktShowEncoding; |
| 958 | #endif |
| 959 | static tTktShowEncoding tktEncode = tktNoTab; |
| 960 | |
| 961 | /* |
| 962 | ** Output the text given in the argument. Convert tabs and newlines into |
| 963 | ** spaces. |
| 964 | */ |
| 965 | static void output_no_tabs_file(const char *z){ |
| 966 | switch( tktEncode ){ |
| 967 | case tktFossilize: |
| 968 | { char *zFosZ; |
| 969 | |
| 970 | if( z && *z ){ |
| 971 | zFosZ = fossilize(z,-1); |
| 972 | printf("%s",zFosZ); |
| 973 | free(zFosZ); |
| 974 | } |
| 975 | break; |
| 976 | } |
| 977 | default: |
| 978 | while( z && z[0] ){ |
| 979 | int i, j; |
| 980 | for(i=0; z[i] && (!isspace(z[i]) || z[i]==' '); i++){} |
| 981 | if( i>0 ){ |
| 982 | printf("%.*s", i, z); |
| 983 | } |
| 984 | for(j=i; isspace(z[j]); j++){} |
| 985 | if( j>i ){ |
| 986 | printf("%*s", j-i, ""); |
| 987 | } |
| 988 | z += j; |
| 989 | } |
| 990 | break; |
| 991 | } |
| 992 | } |
| 993 | |
| 994 | /* |
| 995 | ** Output a row as a tab-separated line of text. |
| @@ -998,11 +1020,16 @@ | |
| 1020 | /* |
| 1021 | ** Generate a report. The rn query parameter is the report number. |
| 1022 | ** The output is written to stdout as flat file. The zFilter paramater |
| 1023 | ** is a full WHERE-condition. |
| 1024 | */ |
| 1025 | void rptshow( |
| 1026 | const char *zRep, |
| 1027 | const char *zSepIn, |
| 1028 | const char *zFilter, |
| 1029 | tTktShowEncoding enc |
| 1030 | ){ |
| 1031 | Stmt q; |
| 1032 | char *zSql; |
| 1033 | char *zTitle; |
| 1034 | char *zOwner; |
| 1035 | char *zClrKey; |
| @@ -1009,34 +1036,43 @@ | |
| 1036 | char *zErr1 = 0; |
| 1037 | char *zErr2 = 0; |
| 1038 | int count = 0; |
| 1039 | int rn; |
| 1040 | |
| 1041 | if (!zRep) { |
| 1042 | zTitle = "tickets"; |
| 1043 | zSql = "SELECT * FROM ticket"; |
| 1044 | zOwner = (char*)g.zLogin; |
| 1045 | zClrKey = ""; |
| 1046 | }else{ |
| 1047 | rn = atoi(zRep); |
| 1048 | if( rn ){ |
| 1049 | db_prepare(&q, |
| 1050 | "SELECT title, sqlcode, owner, cols FROM reportfmt WHERE rn=%d", rn); |
| 1051 | }else{ |
| 1052 | db_prepare(&q, |
| 1053 | "SELECT title, sqlcode, owner, cols FROM reportfmt WHERE title='%s'", zRep); |
| 1054 | } |
| 1055 | if( db_step(&q)!=SQLITE_ROW ){ |
| 1056 | db_finalize(&q); |
| 1057 | fossil_fatal("unkown report format(%s)!",zRep); |
| 1058 | } |
| 1059 | zTitle = db_column_malloc(&q, 0); |
| 1060 | zSql = db_column_malloc(&q, 1); |
| 1061 | zOwner = db_column_malloc(&q, 2); |
| 1062 | zClrKey = db_column_malloc(&q, 3); |
| 1063 | db_finalize(&q); |
| 1064 | } |
| 1065 | if( zFilter ){ |
| 1066 | zSql = mprintf("SELECT * FROM (%s) WHERE %s",zSql,zFilter); |
| 1067 | } |
| 1068 | count = 0; |
| 1069 | tktEncode = enc; |
| 1070 | zSep = zSepIn; |
| 1071 | sqlite3_set_authorizer(g.db, report_query_authorizer, (void*)&zErr1); |
| 1072 | sqlite3_exec(g.db, zSql, output_separated_file, &count, &zErr2); |
| 1073 | sqlite3_set_authorizer(g.db, 0, 0); |
| 1074 | if( zFilter ){ |
| 1075 | free(zSql); |
| 1076 | } |
| 1077 | } |
| 1078 | |
| 1079 |
+33
-5
| --- src/tkt.c | ||
| +++ src/tkt.c | ||
| @@ -837,22 +837,37 @@ | ||
| 837 | 837 | ** COMMAND: ticket |
| 838 | 838 | ** Usage: %fossil ticket SUBCOMMAND ... |
| 839 | 839 | ** |
| 840 | 840 | ** Run various subcommands to control tickets |
| 841 | 841 | ** |
| 842 | -** %fossil ticket show (REPORTNR|REPORTTITLE) ?TICKETFILTER? ?-l|--limit LIMITCHAR? | |
| 842 | +** %fossil ticket show (REPORTTITLE|REPORTNR) ?TICKETFILTER? ?options? | |
| 843 | +** | |
| 844 | +** options can be: | |
| 845 | +** ?-l|--limit LIMITCHAR? | |
| 846 | +** ?-q|--quote? | |
| 843 | 847 | ** |
| 844 | -** Run the the ticket report, identified by the report number | |
| 848 | +** Run the the ticket report, identified by the report title | |
| 845 | 849 | ** used in the gui. The data is written as flat file on stdout, |
| 846 | 850 | ** using "," as separator. The seperator "," can be changed using |
| 847 | 851 | ** the -l or --limit option. |
| 848 | 852 | ** If TICKETFILTER is given on the commandline, the query is |
| 849 | 853 | ** limited with a new WHERE-condition. |
| 850 | 854 | ** example: Report lists a column # with the uuid |
| 851 | 855 | ** TICKETFILTER may be [#]='uuuuuuuuu' |
| 852 | -** Instead of the report number its possible to use the report | |
| 853 | -** title (please quote the string, if it contains whitespace). | |
| 856 | +** If the option -q|--quote is used, the tickets are encoded by | |
| 857 | +** quoting special chars(space -> \\s, tab -> \\t, newline -> \\n, | |
| 858 | +** cr -> \\r, formfeed -> \\f, vtab -> \\v, nul -> \\0, \\ -> \\\\). | |
| 859 | +** Otherwise, the simplified encoding as on the show report raw | |
| 860 | +** page in the gui is used. | |
| 861 | +** | |
| 862 | +** Instead of the report title its possible to use the report | |
| 863 | +** number. Using the special report number 0 list all columns, | |
| 864 | +** defined in the ticket table. | |
| 865 | +** | |
| 866 | +** %fossil ticket list | |
| 867 | +** | |
| 868 | +** list all columns, defined in the ticket table | |
| 854 | 869 | ** |
| 855 | 870 | ** %fossil ticket set TICKETUUID FIELD VALUE ?FIELD VALUE ... ? |
| 856 | 871 | ** |
| 857 | 872 | ** change ticket identified by TICKETUUID and set the value of |
| 858 | 873 | ** field FIELD to VALUE. Valid field descriptions are: |
| @@ -888,25 +903,38 @@ | ||
| 888 | 903 | usage("add|set|show"); |
| 889 | 904 | }else{ |
| 890 | 905 | n = strlen(g.argv[2]); |
| 891 | 906 | if( n==1 && g.argv[2][0]=='s' ){ |
| 892 | 907 | usage("ticket show|set|add"); |
| 908 | + }else if( strncmp(g.argv[2],"list",n)==0 ){ | |
| 909 | + int i; | |
| 910 | + | |
| 911 | + /* read all available ticket fields */ | |
| 912 | + getAllTicketFields(); | |
| 913 | + for(i=0; i<nField; i++){ | |
| 914 | + printf("%s\n",azField[i]); | |
| 915 | + } | |
| 893 | 916 | }else if( strncmp(g.argv[2],"show",n)==0 ){ |
| 894 | 917 | if( g.argc==3 ){ |
| 895 | 918 | usage("ticket show REPORTNR"); |
| 896 | 919 | }else{ |
| 897 | 920 | const char *zRep = 0; |
| 898 | 921 | const char *zSep = 0; |
| 899 | 922 | const char *zFilterUuid = 0; |
| 923 | + tTktShowEncoding tktEncoding; | |
| 900 | 924 | |
| 901 | 925 | zSep = find_option("limit","l",1); |
| 926 | + tktEncoding = find_option("quote","q",0) ? tktFossilize : tktNoTab; | |
| 902 | 927 | zRep = g.argv[3]; |
| 928 | + if( !strcmp(zRep,"0") ){ | |
| 929 | + zRep = 0; | |
| 930 | + } | |
| 903 | 931 | if( g.argc>4 ){ |
| 904 | 932 | zFilterUuid = g.argv[4]; |
| 905 | 933 | } |
| 906 | 934 | |
| 907 | - rptshow( zRep, zSep, zFilterUuid ); | |
| 935 | + rptshow( zRep, zSep, zFilterUuid, tktEncoding ); | |
| 908 | 936 | |
| 909 | 937 | } |
| 910 | 938 | }else{ |
| 911 | 939 | enum { set,add,err } eCmd = err; |
| 912 | 940 | int i; |
| 913 | 941 |
| --- src/tkt.c | |
| +++ src/tkt.c | |
| @@ -837,22 +837,37 @@ | |
| 837 | ** COMMAND: ticket |
| 838 | ** Usage: %fossil ticket SUBCOMMAND ... |
| 839 | ** |
| 840 | ** Run various subcommands to control tickets |
| 841 | ** |
| 842 | ** %fossil ticket show (REPORTNR|REPORTTITLE) ?TICKETFILTER? ?-l|--limit LIMITCHAR? |
| 843 | ** |
| 844 | ** Run the the ticket report, identified by the report number |
| 845 | ** used in the gui. The data is written as flat file on stdout, |
| 846 | ** using "," as separator. The seperator "," can be changed using |
| 847 | ** the -l or --limit option. |
| 848 | ** If TICKETFILTER is given on the commandline, the query is |
| 849 | ** limited with a new WHERE-condition. |
| 850 | ** example: Report lists a column # with the uuid |
| 851 | ** TICKETFILTER may be [#]='uuuuuuuuu' |
| 852 | ** Instead of the report number its possible to use the report |
| 853 | ** title (please quote the string, if it contains whitespace). |
| 854 | ** |
| 855 | ** %fossil ticket set TICKETUUID FIELD VALUE ?FIELD VALUE ... ? |
| 856 | ** |
| 857 | ** change ticket identified by TICKETUUID and set the value of |
| 858 | ** field FIELD to VALUE. Valid field descriptions are: |
| @@ -888,25 +903,38 @@ | |
| 888 | usage("add|set|show"); |
| 889 | }else{ |
| 890 | n = strlen(g.argv[2]); |
| 891 | if( n==1 && g.argv[2][0]=='s' ){ |
| 892 | usage("ticket show|set|add"); |
| 893 | }else if( strncmp(g.argv[2],"show",n)==0 ){ |
| 894 | if( g.argc==3 ){ |
| 895 | usage("ticket show REPORTNR"); |
| 896 | }else{ |
| 897 | const char *zRep = 0; |
| 898 | const char *zSep = 0; |
| 899 | const char *zFilterUuid = 0; |
| 900 | |
| 901 | zSep = find_option("limit","l",1); |
| 902 | zRep = g.argv[3]; |
| 903 | if( g.argc>4 ){ |
| 904 | zFilterUuid = g.argv[4]; |
| 905 | } |
| 906 | |
| 907 | rptshow( zRep, zSep, zFilterUuid ); |
| 908 | |
| 909 | } |
| 910 | }else{ |
| 911 | enum { set,add,err } eCmd = err; |
| 912 | int i; |
| 913 |
| --- src/tkt.c | |
| +++ src/tkt.c | |
| @@ -837,22 +837,37 @@ | |
| 837 | ** COMMAND: ticket |
| 838 | ** Usage: %fossil ticket SUBCOMMAND ... |
| 839 | ** |
| 840 | ** Run various subcommands to control tickets |
| 841 | ** |
| 842 | ** %fossil ticket show (REPORTTITLE|REPORTNR) ?TICKETFILTER? ?options? |
| 843 | ** |
| 844 | ** options can be: |
| 845 | ** ?-l|--limit LIMITCHAR? |
| 846 | ** ?-q|--quote? |
| 847 | ** |
| 848 | ** Run the the ticket report, identified by the report title |
| 849 | ** used in the gui. The data is written as flat file on stdout, |
| 850 | ** using "," as separator. The seperator "," can be changed using |
| 851 | ** the -l or --limit option. |
| 852 | ** If TICKETFILTER is given on the commandline, the query is |
| 853 | ** limited with a new WHERE-condition. |
| 854 | ** example: Report lists a column # with the uuid |
| 855 | ** TICKETFILTER may be [#]='uuuuuuuuu' |
| 856 | ** If the option -q|--quote is used, the tickets are encoded by |
| 857 | ** quoting special chars(space -> \\s, tab -> \\t, newline -> \\n, |
| 858 | ** cr -> \\r, formfeed -> \\f, vtab -> \\v, nul -> \\0, \\ -> \\\\). |
| 859 | ** Otherwise, the simplified encoding as on the show report raw |
| 860 | ** page in the gui is used. |
| 861 | ** |
| 862 | ** Instead of the report title its possible to use the report |
| 863 | ** number. Using the special report number 0 list all columns, |
| 864 | ** defined in the ticket table. |
| 865 | ** |
| 866 | ** %fossil ticket list |
| 867 | ** |
| 868 | ** list all columns, defined in the ticket table |
| 869 | ** |
| 870 | ** %fossil ticket set TICKETUUID FIELD VALUE ?FIELD VALUE ... ? |
| 871 | ** |
| 872 | ** change ticket identified by TICKETUUID and set the value of |
| 873 | ** field FIELD to VALUE. Valid field descriptions are: |
| @@ -888,25 +903,38 @@ | |
| 903 | usage("add|set|show"); |
| 904 | }else{ |
| 905 | n = strlen(g.argv[2]); |
| 906 | if( n==1 && g.argv[2][0]=='s' ){ |
| 907 | usage("ticket show|set|add"); |
| 908 | }else if( strncmp(g.argv[2],"list",n)==0 ){ |
| 909 | int i; |
| 910 | |
| 911 | /* read all available ticket fields */ |
| 912 | getAllTicketFields(); |
| 913 | for(i=0; i<nField; i++){ |
| 914 | printf("%s\n",azField[i]); |
| 915 | } |
| 916 | }else if( strncmp(g.argv[2],"show",n)==0 ){ |
| 917 | if( g.argc==3 ){ |
| 918 | usage("ticket show REPORTNR"); |
| 919 | }else{ |
| 920 | const char *zRep = 0; |
| 921 | const char *zSep = 0; |
| 922 | const char *zFilterUuid = 0; |
| 923 | tTktShowEncoding tktEncoding; |
| 924 | |
| 925 | zSep = find_option("limit","l",1); |
| 926 | tktEncoding = find_option("quote","q",0) ? tktFossilize : tktNoTab; |
| 927 | zRep = g.argv[3]; |
| 928 | if( !strcmp(zRep,"0") ){ |
| 929 | zRep = 0; |
| 930 | } |
| 931 | if( g.argc>4 ){ |
| 932 | zFilterUuid = g.argv[4]; |
| 933 | } |
| 934 | |
| 935 | rptshow( zRep, zSep, zFilterUuid, tktEncoding ); |
| 936 | |
| 937 | } |
| 938 | }else{ |
| 939 | enum { set,add,err } eCmd = err; |
| 940 | int i; |
| 941 |