-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSummary.diff
2385 lines (2371 loc) · 83.8 KB
/
Summary.diff
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
🗣️ Summary from Summary/v0.0.1 to Summary/v0.0.2 in .
diff --git a/Cargo.toml b/Cargo.toml
index 745ad03..c769c35 100644
--- a/Cargo.toml
+++ b/Cargo.toml
- version = "0.0.1"
+ version = "0.0.2"
🗣️ Summary from Summary/v0.0.2 to Summary/v0.0.3 in .
diff --git a/build.rs b/build.rs
index 73ccc94..1f0de60 100644
--- a/build.rs
+++ b/build.rs
- use serde::Deserialize;
- use std::fs;
-
+
+ use serde::Deserialize;
+ use std::fs;
diff --git a/Cargo.toml b/Cargo.toml
index c769c35..c10016a 100644
--- a/Cargo.toml
+++ b/Cargo.toml
+ regex = "1.10.5"
- version = "0.0.2"
+ version = "0.0.3"
diff --git a/README.md b/README.md
index fd4bfe5..018729b 100644
--- a/README.md
+++ b/README.md
- `Summary` is a command-line tool that executes commands in multiple directories
- simultaneously. It leverages parallel processing and concurrent `I/O` to
- efficiently run tasks across directories.
+ `Summary` is a powerful command-line tool designed for efficient file processing
+ and summarization. It offers both sequential and parallel processing
+ capabilities, along with flexible file filtering options.
+ ## Feature
+
+ - Directory traversal and file filtering
+ - Parallel and sequential processing modes
+ - Customizable file pattern matching
+ - Exclusion of specified files or directories
+ - Integration with Pieces OS for enhanced functionality
+
+ ## Pieces OS Integration
+
+ The `Summary` CLI supports Pieces OS, essentially acting as a plugin that can
+ rewrite the whole system. This integration allows for:
+
+ - Enhanced code analysis and summarization.
+ - Improved context-aware processing.
+ - Seamless integration with other Pieces OS-compatible tools.
+ - Potential for AI-driven insights and optimizations.
+
+ By leveraging Pieces OS, `Summary` can tap into a broader ecosystem of
+ development tools and services, significantly expanding its capabilities beyond
+ basic file processing.
+
+ The `Summary` tool can be used with various options:
+
+ - `--Root` or `-R`: Set the current working directory
+ - `--Parallel` or `-P`: Run commands in parallel
+ - `--Exclude`: Exclude certain files or directories
+ - `--Pattern`: Specify a custom pattern for matching
+ - `--Separator`: Define a custom separator
+
+ For Pieces OS integration, refer to the Pieces OS documentation for specific
+ flags and configuration options.
+ [Pieces](https://GitHub.Com/PlayForm/Pieces.git)
+
- - `clap` - Parses command-line arguments
- - `rayon` - Enables parallel processing
- - `tokio` - Provides an asynchronous runtime
- - `walkdir` - Facilitates efficient filesystem traversal
+ - `clap` - For parsing command-line arguments.
+ - `rayon` - For parallel processing.
+ - `tokio` - For asynchronous runtime.
+ - `walkdir` - For efficient filesystem traversal.
+
+ [Pieces OS](https://Pieces.App): For extended functionality and system
+ integration.
diff --git a/Source/Fn/Binary/Command.rs b/Source/Fn/Binary/Command.rs
index c590122..4cfbb9f 100644
--- a/Source/Fn/Binary/Command.rs
+++ b/Source/Fn/Binary/Command.rs
+ .arg(
+ Arg::new("Exclude")
+ .short('E')
+ .long("Exclude")
+ .display_order(4)
+ .value_name("EXCLUDE")
+ .required(false)
+ .help("Exclude 🚫")
+ .default_value("node_modules"),
+ )
+ .arg(
+ Arg::new("Omit")
+ .short('O')
+ .long("Omit")
+ .display_order(6)
+ .value_name("OMIT")
+ .required(false)
+ .help("Omit 🚫")
+ .action(clap::ArgAction::Append)
+ .default_value("Documentation"),
+ )
+ .arg(
+ Arg::new("Pattern")
+ .long("Pattern")
+ .display_order(5)
+ .value_name("PATTERN")
+ .required(false)
+ .help("Pattern 🔍")
+ .default_value(".git"),
+ )
- .arg(
- Arg::new("Exclude")
- .short('E')
- .long("Exclude")
- .display_order(4)
- .value_name("EXCLUDE")
- .required(false)
- .help("Exclude 🚫")
- .default_value("node_modules"),
- )
- .arg(
- Arg::new("Pattern")
- .display_order(5)
- .value_name("PATTERN")
- .required(false)
- .help("Pattern 🔍")
- .default_value(".git"),
- )
diff --git a/Source/Fn/Binary/Command/Parallel.rs b/Source/Fn/Binary/Command/Parallel.rs
index 37a5949..463f890 100644
--- a/Source/Fn/Binary/Command/Parallel.rs
+++ b/Source/Fn/Binary/Command/Parallel.rs
- pub async fn Fn(Option { Entry, Separator, Pattern, .. }: Option) {
- let Queue: Vec<_> = stream::iter(
+ pub async fn Fn(Option { Entry, Separator, Pattern, Omit, .. }: Option) {
+ stream::iter(
- .map(|Entry| async move {
- match crate::Fn::Summary::Fn(&Entry).await {
- Ok(summary) => Ok(summary),
- Err(e) => Err(format!("Error generating summary for {}: {}", Entry, e)),
+ .map(|Entry| {
+ let Omit = Omit.clone();
+
+ async move {
+ match crate::Fn::Summary::Fn(&Entry, &crate::Fn::Summary::Difference::Option { Omit })
+ .await
+ {
+ Ok(Summary) => Ok(Summary),
+ Err(_Error) => Err(format!("Error generating summary for {}: {}", Entry, _Error)),
+ }
- .collect()
+ .collect::<Vec<_>>()
-
- Queue.par_iter().for_each(|Output| match Output {
- Ok(Summary) => println!("Summary: {:?}", Summary),
- Err(Error) => eprintln!("Error: {}", Error),
- });
diff --git a/Source/Fn/Binary/Command/Sequential.rs b/Source/Fn/Binary/Command/Sequential.rs
index 63923f7..c19801b 100644
--- a/Source/Fn/Binary/Command/Sequential.rs
+++ b/Source/Fn/Binary/Command/Sequential.rs
- pub fn Fn(Option { Entry, Pattern, Separator, .. }: Option) {
+ pub async fn Fn(Option { Entry, Pattern, Separator, Omit, .. }: Option) {
+ futures::future::join_all(
- .for_each(|_Entry| {
- // TODO: GENERATE SUMMARY
+ .map(|Entry| {
+ let Omit = Omit.clone();
+
+ async move {
+ match crate::Fn::Summary::Fn(
+ &Entry,
+ &crate::Fn::Summary::Difference::Option { Omit },
+ )
+ .await
+ {
+ Ok(Summary) => Ok(Summary),
+ Err(_Error) => {
+ Err(format!("Error generating summary for {}: {}", Entry, _Error))
+ }
+ }
+ }
+ .collect::<Vec<_>>(),
+ ).await;
diff --git a/Source/Fn/Summary.rs b/Source/Fn/Summary.rs
index eb2d2ce..f6825a8 100644
--- a/Source/Fn/Summary.rs
+++ b/Source/Fn/Summary.rs
- pub async fn Fn(Entry: &str) -> Result<(), Box<dyn std::error::Error>> {
- let Repository = Repository::open(Entry)?;
-
+ pub async fn Fn(
+ Entry: &str,
+ Option: &crate::Fn::Summary::Difference::Option,
+ ) -> Result<(), Box<dyn std::error::Error>> {
+ match Repository::open(Entry) {
+ Ok(Repository) => {
- let mut Start = None;
-
- let Summary = "Summary";
- fs::create_dir_all(Summary)?;
-
- for i in 0..Tag.len() {
- if let Some(Tag) = Tag.get(i) {
- if let Some(Start) = Start {
- let Difference = crate::Fn::Summary::Difference::Fn(&Repository, Start, Tag)?;
- File::create(&format!("{}/Difference_{}_{}.txt", Summary, Start, Tag))?.write_all(
- crate::Fn::Summary::Difference::Fn(&Repository, Start, Tag)?.as_bytes(),
- )?;
+ let Tags: Vec<_> = Tag.iter().filter_map(|Tag| Tag).collect();
- File::create(&format!("{}/Release_{}_{}.txt", Summary, Start, Tag))?
- .write_all(crate::Fn::Summary::Release::Fn(&Difference).as_bytes())?;
+ for (Index, &Current) in Tags.iter().enumerate() {
+ for (_, &Next) in Tags.iter().enumerate().skip(Index + 1) {
+ println!(
+ "{}",
+ crate::Fn::Summary::Difference::Fn(&Repository, Current, Next, Option)?
+ );
-
- Start = Some(Tag);
+ }
+ }
+ Err(_Error) => {
+ println!("Failed to open repository: {}", _Error);
+ return Err(_Error.into());
- use std::{
- fs::{self, File},
- io::Write,
- };
- pub mod Release;
diff --git a/Source/Fn/Summary/Difference.rs b/Source/Fn/Summary/Difference.rs
index 8d7badf..4951c08 100644
--- a/Source/Fn/Summary/Difference.rs
+++ b/Source/Fn/Summary/Difference.rs
- pub fn Fn(Repo: &git2::Repository, Start: &str, End: &str) -> Result<String, git2::Error> {
+ pub fn Fn(
+ Repository: &git2::Repository,
+ Start: &str,
+ End: &str,
+ Option: &Option,
+ ) -> Result<String, git2::Error> {
+ let mut Options = git2::DiffOptions::new();
- Repo.diff_tree_to_tree(
- Some(&Repo.revparse_single(Start)?.peel_to_commit()?.tree()?),
- Some(&Repo.revparse_single(End)?.peel_to_commit()?.tree()?),
- Some(&mut git2::DiffOptions::new()),
+ // Options.pathspec(
+ // std::ffi::CString::new(
+ // std::iter::once("*".to_string())
+ // .chain(Option.Omit.iter().map(|Omit| format!("{}", Omit)))
+ // .collect::<Vec<String>>()
+ // .join("\0"),
+ // )
+ // .expect("Cannot create CString"),
+ // );
+
+ Options.indent_heuristic(true);
+ Options.minimal(true);
+ Options.force_text(true);
+ Options.ignore_blank_lines(true);
+ Options.ignore_case(true);
+ Options.ignore_filemode(true);
+ Options.ignore_whitespace(true);
+ Options.ignore_whitespace_change(true);
+ Options.ignore_whitespace_eol(true);
+
+ Repository
+ .diff_tree_to_tree(
+ Some(&Repository.revparse_single(Start)?.peel_to_commit()?.tree()?),
+ Some(&Repository.revparse_single(End)?.peel_to_commit()?.tree()?),
+ Some(&mut Options),
- .print(git2::DiffFormat::Patch, |_, _, line| {
- Difference.push_str(std::str::from_utf8(line.content()).unwrap());
+ .print(git2::DiffFormat::Patch, |Delta, _, Line| {
+ if !Option
+ .Omit
+ .iter()
+ .map(|Omit: &String| regex::Regex::new(Omit).expect("Cannot Regex."))
+ .collect::<Vec<_>>()
+ .iter()
+ .any(|Omit| {
+ Omit.is_match(&Delta.old_file().path().unwrap().display().to_string())
+ || Omit.is_match(&Delta.new_file().path().unwrap().display().to_string())
+ }) {
+ Difference.push_str(std::str::from_utf8(Line.content()).unwrap());
+ };
+
+
+ pub struct Option {
+ pub Omit: Vec<String>,
+ }
diff --git a/Source/Fn/Summary/Release.rs b/Source/Fn/Summary/Release.rs
deleted file mode 100644
index 611f1eb..0000000
--- a/Source/Fn/Summary/Release.rs
+++ /dev/null
- /// Generates a release summary.
- ///
- /// # Arguments
- ///
- /// * `Option` - A struct containing the necessary information for generating the release summary.
- ///
- /// # Returns
- ///
- /// * `Return` - The generated release summary.
- ///
- /// # Example
- ///
- /// ```
- /// let option = Option {
- /// // Fields needed for release summary generation
- /// };
- /// let release_summary = Fn(&option);
- /// ```
- pub fn Fn(Difference: &str) -> String {
- let mut Release = String::new();
-
- Release.push_str("Release Notes:\n");
-
- for Difference in Difference.lines() {
- if Difference.starts_with("+") && !Difference.starts_with("+++") {
- Release.push_str(&format!("Added: {}\n", &Difference[1..]));
- } else if Difference.starts_with("-") && !Difference.starts_with("---") {
- Release.push_str(&format!("Removed: {}\n", &Difference[1..]));
- }
- }
-
- Release
- }
diff --git a/Source/Struct/Binary/Command.rs b/Source/Struct/Binary/Command.rs
index da03f34..4a356ae 100644
--- a/Source/Struct/Binary/Command.rs
+++ b/Source/Struct/Binary/Command.rs
- Sequential::Fn(Option);
+ Sequential::Fn(Option).await;
diff --git a/Source/Struct/Binary/Command/Entry.rs b/Source/Struct/Binary/Command/Entry.rs
index c0c6b89..45d3e41 100644
--- a/Source/Struct/Binary/Command/Entry.rs
+++ b/Source/Struct/Binary/Command/Entry.rs
+
+ /// List of items to omit from processing.
+ pub Omit: Omit,
+ Omit: Option.Omit.clone(),
- use crate::Struct::Binary::Command::Option::{Parallel, Pattern, Separator, Struct as Option};
+ use crate::Struct::Binary::Command::Option::{
+ Omit, Parallel, Pattern, Separator, Struct as Option,
+ };
diff --git a/Source/Struct/Binary/Command/Option.rs b/Source/Struct/Binary/Command/Option.rs
index 8453d33..8d32f31 100644
--- a/Source/Struct/Binary/Command/Option.rs
+++ b/Source/Struct/Binary/Command/Option.rs
+ /// List of items to omit from processing.
+ pub Omit: Vec<String>,
+
- Exclude: Fn()
+ Exclude: Command()
- .map(|Command| Command.to_string())
+ .map(|Exclude| Exclude.to_string())
- Parallel: Fn().get_flag("Parallel"),
- Pattern: Fn().get_one::<String>("Pattern").expect("Cannot Pattern.").to_owned(),
- Root: Fn().get_one::<String>("Root").expect("Cannot Root.").to_owned(),
+ Parallel: Command().get_flag("Parallel"),
+ Pattern: Command().get_one::<String>("Pattern").expect("Cannot Pattern.").to_owned(),
+ Root: Command().get_one::<String>("Root").expect("Cannot Root.").to_owned(),
+ Omit: Command()
+ .get_many::<String>("Omit")
+ .expect("Cannot Omit.")
+ .map(|Omit| Omit.to_string())
+ .collect(),
- use crate::{Fn::Binary::Command::Fn, Struct::Binary::Command::Struct as Option};
+ use crate::{Fn::Binary::Command::Fn as Command, Struct::Binary::Command::Struct as Option};
+ pub type Omit = Vec<String>;
🗣️ Summary from Summary/v0.0.3 to Summary/v0.0.4 in .
diff --git a/Cargo.toml b/Cargo.toml
index c10016a..3d3159a 100644
--- a/Cargo.toml
+++ b/Cargo.toml
- version = "0.0.3"
+ version = "0.0.4"
diff --git a/README.md b/README.md
index 018729b..49bf9ea 100644
--- a/README.md
+++ b/README.md
- `Summary` is a powerful command-line tool designed for efficient file processing
- and summarization. It offers both sequential and parallel processing
+ `Summary` is a powerful command-line tool designed for efficient Git repository
+ analysis and summarization. It offers both sequential and parallel processing
- ## Feature
+ ## Features
- - Directory traversal and file filtering
- - Parallel and sequential processing modes
+ - Diff generation between `Git` tags
+ - Directory traversal and file filtering
- - Integration with Pieces OS for enhanced functionality
+ - `Git` repository analysis
+ - Integration with [Pieces OS] for enhanced functionality
+ - Parallel and sequential processing modes
- ## Pieces OS Integration
+ ## [Pieces OS] Integration
- The `Summary` CLI supports Pieces OS, essentially acting as a plugin that can
- rewrite the whole system. This integration allows for:
+ The `Summary` CLI supports [Pieces OS], allowing it to:
- - Enhanced code analysis and summarization.
- - Improved context-aware processing.
- - Seamless integration with other Pieces OS-compatible tools.
- - Potential for AI-driven insights and optimizations.
+ - Generate comprehensive diff logs and release notes automatically.
+ - Provide AI-driven code analysis and insights.
+ - Offer improved context-aware processing of repository changes.
+ - Seamlessly interact with other [Pieces OS]-compatible development tools.
- By leveraging Pieces OS, `Summary` can tap into a broader ecosystem of
- development tools and services, significantly expanding its capabilities beyond
- basic file processing.
+ By leveraging [Pieces OS], `Summary` can tap into a broader ecosystem of development
+ tools and services, significantly expanding its capabilities beyond basic file processing.
+ The Summary tool can be used with various options:
+
+ ```
+ Summary 🗣️
+
+ Usage: Summary [OPTIONS]
+
+ Options:
+ -P, --Parallel Parallel ⏩
+ -R, --Root <ROOT> Root 📂 [default: .]
+ -E, --Exclude <EXCLUDE> Exclude 🚫 [default: node_modules]
+ --Pattern <PATTERN> Pattern 🔍 [default: .git]
+ -O, --Omit <OMIT> Omit 🚫 [default: Documentation]
+ -h, --help Print help
+ -V, --version Print version
+ ```
+
+ This command will generate summaries for all the Git tags inside the specified
+ repository.
+
+ ## Options
+
- - `--Root` or `-R`: Set the current working directory
- - `--Parallel` or `-P`: Run commands in parallel
- - `--Exclude`: Exclude certain files or directories
- - `--Pattern`: Specify a custom pattern for matching
- - `--Separator`: Define a custom separator
+ #### --Exclude or -E:
- For Pieces OS integration, refer to the Pieces OS documentation for specific
- flags and configuration options.
- [Pieces](https://GitHub.Com/PlayForm/Pieces.git)
+ Exclude certain files or directories (defailt is `node_modules`).
- ```sh
- Summary
- ```
+ #### --Omit or -O:
- This command will fetch from upstream for all `.git` repositories inside the
- current directory. It essentially replaces the following command:
+ Specify regex patterns to omit files from processing (default is
+ "Documentation").
- ```sh
- find -iname .git -type d -execdir git fetch upstream \;
- ```
+ #### --Parallel or -P:
- ## Options
+ Run processing in parallel (default is `sequential`):
+
+ #### --Pattern:
+
+ Specify a custom pattern for matching (defailt is `.git`).
- ```sh
- Summary -R D:\Developer .git git fetch upstream
- ```
+ For [Pieces OS] integration, refer to the [Pieces OS] documentation for specific
+ flags and configuration options. [Pieces OS]
- #### --Parallel or -P:
+ ## Examples
- Summary commands in `parallel` (default is `sequential`):
+ Analyze the current directory:
- Summary -P -R D:\Developer .git git fetch upstream
+ Summary
- #### --Exclude:
+ Analyze a specific directory in parallel:
- Exclude certain files or directories (defailt is
- `node_modules target dist vendor`)
+ ```sh
+ Summary -P -R D:\Developer
+ ```
- #### --Pattern:
+ Exclude additional directories:
- Specify a custom pattern for matching (defailt is `.git`)
+ ```sh
+ Summary -E "node_modules target dist vendor"
+ ```
- #### --Separator:
+ Omit specific file patterns:
- Define a custom separator
+ ```sh
+ Summary -O "\.md$" -O "\.txt$"
+ ```
+ - `futures` - For asynchronous programming abstractions.
+ - `git2` - For Git repository operations.
+ - `num_cpus` - For determining the number of CPUs for parallel processing.
+ - `regex` - For pattern matching and text manipulation.
- [Pieces OS](https://Pieces.App): For extended functionality and system
- integration.
+ [Pieces OS] For extended functionality and system integration.
+ [Pieces OS]: HTTPS://Pieces.App
diff --git a/Source/Fn/Summary/Difference.rs b/Source/Fn/Summary/Difference.rs
index 4951c08..d96794d 100644
--- a/Source/Fn/Summary/Difference.rs
+++ b/Source/Fn/Summary/Difference.rs
- // Options.pathspec(
- // std::ffi::CString::new(
- // std::iter::once("*".to_string())
- // .chain(Option.Omit.iter().map(|Omit| format!("{}", Omit)))
- // .collect::<Vec<String>>()
- // .join("\0"),
- // )
- // .expect("Cannot create CString"),
- // );
-
🗣️ Summary from Summary/v0.0.4 to Summary/v0.0.5 in .
diff --git a/Cargo.toml b/Cargo.toml
index 3d3159a..3615257 100644
--- a/Cargo.toml
+++ b/Cargo.toml
- version = "0.0.4"
+ version = "0.0.5"
diff --git a/README.md b/README.md
index 49bf9ea..4449a1b 100644
--- a/README.md
+++ b/README.md
- `Summary` is a powerful command-line tool designed for efficient Git repository
- analysis and summarization. It offers both sequential and parallel processing
- capabilities, along with flexible file filtering options.
+ `Summary` is a powerful command-line tool designed for efficient `Git`
+ repository analysis and summarization. It offers both sequential and parallel
+ processing capabilities, along with flexible file filtering options.
- - Customizable file pattern matching
- - Diff generation between `Git` tags
- - Directory traversal and file filtering
- - Exclusion of specified files or directories
- - `Git` repository analysis
- - Integration with [Pieces OS] for enhanced functionality
- - Parallel and sequential processing modes
+ - Customizable file pattern matching.
+ - Diff generation between `Git` tags.
+ - Directory traversal and file filtering.
+ - Exclusion of specified files or directories.
+ - `Git` repository analysis.
+ - Integration with [Pieces OS] for enhanced functionality.
+ - Parallel and sequential processing modes.
- This command will generate summaries for all the Git tags inside the specified
+ This command will generate summaries for all the `Git` tags inside the specified
- - `git2` - For Git repository operations.
+ - `git2` - For `Git` repository operations.
diff --git a/Source/Fn/Binary/Command/Parallel.rs b/Source/Fn/Binary/Command/Parallel.rs
index 463f890..22654c0 100644
--- a/Source/Fn/Binary/Command/Parallel.rs
+++ b/Source/Fn/Binary/Command/Parallel.rs
- stream::iter(
+ futures::stream::iter(
- match crate::Fn::Summary::Fn(&Entry, &crate::Fn::Summary::Difference::Option { Omit })
+ match crate::Fn::Summary::Fn(
+ &Entry,
+ &crate::Struct::Summary::Difference::Struct { Omit },
+ )
+ use futures::stream::StreamExt;
+ use rayon::prelude::{IntoParallelIterator, ParallelIterator};
+
- use futures::stream::{self, StreamExt};
- use rayon::prelude::*;
diff --git a/Source/Fn/Binary/Command/Sequential.rs b/Source/Fn/Binary/Command/Sequential.rs
index c19801b..7ffeb0f 100644
--- a/Source/Fn/Binary/Command/Sequential.rs
+++ b/Source/Fn/Binary/Command/Sequential.rs
- &crate::Fn::Summary::Difference::Option { Omit },
+ &crate::Struct::Summary::Difference::Struct { Omit },
- ).await;
+ )
+ .await;
diff --git a/Source/Fn/Summary.rs b/Source/Fn/Summary.rs
index f6825a8..ae3e650 100644
--- a/Source/Fn/Summary.rs
+++ b/Source/Fn/Summary.rs
- Option: &crate::Fn::Summary::Difference::Option,
+ Option: &crate::Struct::Summary::Difference::Struct,
- let Tag = Repository.tag_names(None)?;
+ let Name = Repository.tag_names(None)?;
- let Tags: Vec<_> = Tag.iter().filter_map(|Tag| Tag).collect();
+ let Tag: Vec<_> = Name.iter().filter_map(|Tag| Tag).collect();
- for (Index, &Current) in Tags.iter().enumerate() {
- for (_, &Next) in Tags.iter().enumerate().skip(Index + 1) {
+ for (Index, &Current) in Tag.iter().enumerate() {
+ for (_, &Next) in Tag.iter().enumerate().skip(Index + 1) {
diff --git a/Source/Fn/Summary/Difference.rs b/Source/Fn/Summary/Difference.rs
index d96794d..cc25057 100644
--- a/Source/Fn/Summary/Difference.rs
+++ b/Source/Fn/Summary/Difference.rs
- Option: &Option,
+ Option: &crate::Struct::Summary::Difference::Struct,
- let mut Difference = String::new();
+ let mut Omit = vec![
+ r"\.pdf$",
+ r"\.exe$",
+ r"\.dll$",
+ r"\.so$",
+ r"\.dylib$",
+ r"\.zip$",
+ r"\.tar$",
+ r"\.gz$",
+ r"\.7z$",
+ r"\.rar$",
+ r"\.jpg$",
+ r"\.jpeg$",
+ r"\.png$",
+ r"\.gif$",
+ r"\.bmp$",
+ r"\.tiff$",
+ r"\.ico$",
+ r"\.svg$",
+ r"\.webp$",
+ r"\.heic$",
+ r"\.mp3$",
+ r"\.wav$",
+ r"\.ogg$",
+ r"\.flac$",
+ r"\.m4a$",
+ r"\.mp4$",
+ r"\.avi$",
+ r"\.mov$",
+ r"\.mkv$",
+ r"\.wmv$",
+ r"\.doc$",
+ r"\.docx$",
+ r"\.xls$",
+ r"\.xlsx$",
+ r"\.ppt$",
+ r"\.pptx$",
+ r"\.db$",
+ r"\.sqlite$",
+ r"\.mdb$",
+ r"\.accdb$",
+ r"\.class$",
+ r"\.pyc$",
+ r"\.pyo$",
+ r"\.o$",
+ r"\.obj$",
+ r"\.bin$",
+ r"\.dat$",
+ r"\.bak$",
+ r"\.iso$",
+ r"\.img$",
+ ];
+
+ Omit.extend(Option.Omit.iter().map(|Omit| Omit.as_str()));
+
+ let Regex = Omit.into_par_iter().filter_map(|Omit| Regex::new(Omit).ok()).collect::<Vec<_>>();
+
+ Options.show_binary(false);
+ Options.force_binary(false);
+
+ let mut Difference = String::new();
- if !Option
- .Omit
- .iter()
- .map(|Omit: &String| regex::Regex::new(Omit).expect("Cannot Regex."))
- .collect::<Vec<_>>()
- .iter()
- .any(|Omit| {
+ if !Regex.iter().any(|Omit| {
- Difference.push_str(std::str::from_utf8(Line.content()).unwrap());
+ match std::str::from_utf8(Line.content()) {
+ Ok(Line) => Difference.push_str(Line),
+ Err(_) => (),
+ }
- pub struct Option {
- pub Omit: Vec<String>,
- }
+ use rayon::prelude::{IntoParallelIterator, ParallelIterator};
+ use regex::Regex;
diff --git a/Source/Struct/mod.rs b/Source/Struct/mod.rs
index a56e8ce..4ca5f2b 100644
--- a/Source/Struct/mod.rs
+++ b/Source/Struct/mod.rs
+ pub mod Summary;
diff --git a/Source/Struct/Summary/Difference.rs b/Source/Struct/Summary/Difference.rs
new file mode 100644
index 0000000..7583a0a
--- /dev/null
+++ b/Source/Struct/Summary/Difference.rs
+ pub struct Struct {
+ pub Omit: Vec<String>,
+ }
diff --git a/Source/Struct/Summary/mod.rs b/Source/Struct/Summary/mod.rs
new file mode 100644
index 0000000..7241509
--- /dev/null
+++ b/Source/Struct/Summary/mod.rs
+ pub mod Difference;
🗣️ Summary from Summary/v0.0.5 to Summary/v0.0.6 in .
diff --git a/Cargo.toml b/Cargo.toml
index 3615257..7c5b90e 100644
--- a/Cargo.toml
+++ b/Cargo.toml
- toml = "0.8.16"
+ toml = "0.8.17"
- version = "0.0.5"
+ version = "0.0.6"
diff --git a/README.md b/README.md
index 4449a1b..d388d49 100644
--- a/README.md
+++ b/README.md
- `Summary` is a powerful command-line tool designed for efficient `Git`
+ [Summary] is a powerful command-line tool designed for efficient `Git`
+ ```sh
+ Summary -P -O Target -O target -O Summary.md -O CHANGELOG.md > Summary.md
+ ```
+
+ [Summary] will now generate the following [Summary.md](./Summary.md) for all the
+ commits and tags between the first and the latest commit.
+
- The `Summary` CLI supports [Pieces OS], allowing it to:
+ The [Summary] CLI supports [Pieces OS], allowing it to:
- By leveraging [Pieces OS], `Summary` can tap into a broader ecosystem of development
+ By leveraging [Pieces OS], [Summary] can tap into a broader ecosystem of development
- The `Summary` tool can be used with various options:
+ The [Summary] tool can be used with various options:
- "Documentation").
+ `Documentation`).
- `Summary` relies on several Rust crates to provide its functionality:
+ [Summary] relies on several Rust crates to provide its functionality:
diff --git a/Source/Fn/Binary/Command.rs b/Source/Fn/Binary/Command.rs
index 4cfbb9f..e355a33 100644
--- a/Source/Fn/Binary/Command.rs
+++ b/Source/Fn/Binary/Command.rs
- /// Defines and configures command-line arguments for the "Summary" command.
- ///
- /// # Returns
+ //! This module defines the command-line interface for the Summary application.
+
+ /// Configures and returns the command-line argument matches for the Summary application.
- /// * `ArgMatches` - The parsed command-line arguments.
+ /// This function sets up the command-line interface using the clap crate, defining
+ /// various arguments and their properties.
- /// # Example
+ /// # Returns
- /// ```
- /// let matches = Fn();
- /// let parallel = matches.get_flag("Parallel");
- /// let root = matches.get_one::<String>("Root").unwrap();
- /// ```
+ /// Returns an `ArgMatches` struct containing the parsed command-line arguments.
- .default_value("Documentation"),
+ .default_values(["Target", "Documentation", r"Summary\.md$"]),
diff --git a/Source/Fn/Binary/Command/Entry.rs b/Source/Fn/Binary/Command/Entry.rs
index 64351c7..387c0e4 100644
--- a/Source/Fn/Binary/Command/Entry.rs
+++ b/Source/Fn/Binary/Command/Entry.rs
- /// Walks through a directory and filters files based on specified criteria.
+ //! This module provides functionality for processing binary command entries.
+
+ /// Processes entries based on the provided options.
- /// * `Option` - A struct containing the following fields:
- /// * `Exclude`: Vec<String> - List of patterns to exclude
- /// * `Pattern`: String - The pattern to match for inclusion
- /// * `Root`: String - The root directory to start the walk from
- /// * `Separator`: char - The path separator character
+ /// * `Option` - A reference to an Option struct containing processing parameters.
- /// * `Return` - A vector of vectors of strings, where each inner vector represents a file path
- /// split into its components.
- ///
- /// # Example
- ///
- /// ```
- /// let option = Option {
- /// Exclude: vec!["node_modules".to_string()],
- /// Pattern: ".git".to_string(),
- /// Root: ".".to_string(),
- /// Separator: std::path::MAIN_SEPARATOR,
- /// };
- /// let result = Fn(&option);
- /// ```
+ /// Returns a vector of processed entries.
diff --git a/Source/Fn/Binary/Command/Parallel.rs b/Source/Fn/Binary/Command/Parallel.rs
index 22654c0..75ef690 100644
--- a/Source/Fn/Binary/Command/Parallel.rs
+++ b/Source/Fn/Binary/Command/Parallel.rs
- /// Processes entries in parallel, filtering and executing commands based on specified criteria.
+ //! This module contains functions for parallel command execution in a binary context.
+
+ /// Executes a sequence of operations asynchronously in parallel based on the provided options.
- /// * `Option` - A struct containing the following fields:
- /// * `Entry`: Vec<Vec<String>> - List of entries to process
- /// * `Separator`: char - The path separator character
- /// * `Pattern`: String - The pattern to match for inclusion
+ /// * `Option` - A struct containing various options for execution, including:
+ /// - `Entry`: A collection of entries to process
+ /// - `Separator`: A separator used for joining entry parts
+ /// - `Pattern`: A pattern to match against the last element of each entry
+ /// - `Omit`: A collection of items to omit from processing
- /// # Example
+ /// # Async
- /// ```
- /// let option = Option {
- /// Entry: vec![vec!["path".to_string(), "to".to_string(), "file.txt".to_string()]],
- /// Separator: '/',
- /// Pattern: "file.txt".to_string(),
- /// };
- /// Fn(option).await;
- /// ```
+ /// This function is asynchronous and returns a future.
diff --git a/Source/Fn/Binary/Command/Sequential.rs b/Source/Fn/Binary/Command/Sequential.rs
index 7ffeb0f..a84435b 100644
--- a/Source/Fn/Binary/Command/Sequential.rs
+++ b/Source/Fn/Binary/Command/Sequential.rs
- /// Processes entries sequentially, filtering and executing commands based on specified criteria.
+ //! This module contains functions for sequential command execution in a binary context.
+
+ /// Executes a sequence of operations asynchronously based on the provided options.
- /// * `Option` - A struct containing the following fields:
- /// * `Entry`: Vec<Vec<String>> - List of entries to process
- /// * `Pattern`: String - The pattern to match for inclusion
- /// * `Separator`: char - The path separator character
+ /// * `Option` - A struct containing various options for execution.
- /// # Example
+ /// # Async
- /// ```
- /// let option = Option {
- /// Entry: vec![vec!["path".to_string(), "to".to_string(), "file.txt".to_string()]],
- /// Pattern: "file.txt".to_string(),
- /// Separator: '/',
- /// };
- /// Fn(option);
- /// ```
+ /// This function is asynchronous and returns a future.
diff --git a/Source/Fn/Summary.rs b/Source/Fn/Summary.rs
index ae3e650..2411611 100644
--- a/Source/Fn/Summary.rs
+++ b/Source/Fn/Summary.rs
- /// Generates a summary based on the provided options.
+ //! This module provides functionality for generating summaries of git repositories.
+
+ /// Generates a summary for a given git repository entry.
- /// * `Option` - A struct containing the necessary information for generating the summary.
+ /// * `Entry` - A string representing the repository path.
+ /// * `Option` - A reference to a struct containing summary options.
- /// * `Return` - The generated summary.
+ /// Returns a Result containing () if successful, or a boxed dynamic error if an error occurs.
- /// # Example
+ /// # Errors
- /// ```
- /// let option = Option {
- /// // Fields needed for summary generation
- /// };
- /// let summary = Fn(&option);
- /// ```
+ /// This function will return an error if the repository cannot be opened or if there are issues
+ /// generating the summary.
- for (Index, &Current) in Tag.iter().enumerate() {
- for (_, &Next) in Tag.iter().enumerate().skip(Index + 1) {
+ let Head = Repository.head()?;
+
+ let First = Repository.find_commit(First::Fn(&Repository)?)?.id().to_string();
+
+ let Last = Head.peel_to_commit()?.id().to_string();
+
+ if Tag.is_empty() {
+ println!("🗣️ Summary from first commit to last commit:");
+
- "{}",
- crate::Fn::Summary::Difference::Fn(&Repository, Current, Next, Option)?
+ "```\n{}\n```",
+ crate::Fn::Summary::Difference::Fn(&Repository, &First, &Last, Option,)?
+ );
+ } else {
+ for Window in Tag.windows(2) {
+ let Start = Window[0];
+ let End = Window[1];
+
+ println!("🗣️ Summary from tag: {} to tag: {}:", Start, End);
+
+ println!(
+ "```\n{}\n```",
+ crate::Fn::Summary::Difference::Fn(&Repository, Start, End, Option)?
+ );
+ }
+
+ if let Some(Latest) = Tag.last() {
+ println!("🗣️ Summary from first commit to latest tag: {}:", Latest);
+
+ println!(
+ "```\n{}\n```",
+ crate::Fn::Summary::Difference::Fn(&Repository, &First, Latest, Option)?
+ );
+
+ println!("🗣️ Summary from latest tag: {} to last commit:", Latest);
+
+ println!(
+ "```\n{}\n```",
+ crate::Fn::Summary::Difference::Fn(&Repository, Latest, &Last, Option)?
- println!("Failed to open repository: {}", _Error);
+ println!("Cannot Repository: {}", _Error);
+
+ pub mod First;
diff --git a/Source/Fn/Summary/Difference.rs b/Source/Fn/Summary/Difference.rs
index cc25057..544095b 100644
--- a/Source/Fn/Summary/Difference.rs
+++ b/Source/Fn/Summary/Difference.rs
- /// Calculates the difference between two summaries.
+ //! This module provides functionality for generating difference summaries between git commits.
+
+ /// Generates a difference summary between two git commits.
- /// * `Option` - A struct containing the necessary information for calculating the difference.
+ /// * `Repository` - A reference to the git Repository.
+ /// * `Start` - The starting commit or reference.
+ /// * `End` - The ending commit or reference.
+ /// * `Option` - A reference to a struct containing difference options.
- /// * `Return` - The calculated difference between the summaries.
- ///
- /// # Example
- ///
- /// ```
- /// let option = Option {
- /// // Fields needed for difference calculation
- /// };
- /// let difference = Fn(&option);
- /// ```
+ /// Returns a Result containing a String with the difference summary if successful,
+ /// or a boxed dynamic error if an error occurs.
- r"\.pdf$",
- r"\.exe$",
+ r"\.7z$",
+ r"\.accdb$",
+ r"\.avi$",
+ r"\.bak$",
+ r"\.bin$",
+ r"\.bmp$",
+ r"\.class$",
+ r"\.dat$",
+ r"\.db$",
- r"\.so$",
+ r"\.dll\.lib$",
+ r"\.dll\.exp$",
+ r"\.doc$",
+ r"\.docx$",
- r"\.zip$",
- r"\.tar$",
- r"\.gz$",
- r"\.7z$",
- r"\.rar$",
- r"\.jpg$",
- r"\.jpeg$",
- r"\.png$",
+ r"\.exe$",
+ r"\.flac$",
- r"\.bmp$",
- r"\.tiff$",
- r"\.ico$",
- r"\.svg$",
- r"\.webp$",
+ r"\.gz$",
- r"\.mp3$",
- r"\.wav$",
- r"\.ogg$",
- r"\.flac$",
+ r"\.ico$",
+ r"\.img$",
+ r"\.iso$",
+ r"\.jpeg$",
+ r"\.jpg$",
- r"\.mp4$",
- r"\.avi$",
- r"\.mov$",
+ r"\.mdb$",
- r"\.wmv$",
- r"\.doc$",
- r"\.docx$",
- r"\.xls$",
- r"\.xlsx$",
+ r"\.mov$",
+ r"\.mp3$",
+ r"\.mp4$",
+ r"\.o$",
+ r"\.obj$",
+ r"\.ogg$",
+ r"\.pdb$",
+ r"\.pdf$",
+ r"\.png$",
- r"\.db$",
- r"\.sqlite$",
- r"\.mdb$",
- r"\.accdb$",
- r"\.class$",
- r"\.o$",
- r"\.obj$",