Skip to content

Commit

Permalink
Add a feature if user wrote 'godoc usage' specified
Browse files Browse the repository at this point in the history
  • Loading branch information
sinalalebakhsh committed Oct 29, 2023
1 parent af655fc commit 8f77d73
Show file tree
Hide file tree
Showing 7 changed files with 90 additions and 4 deletions.
11 changes: 11 additions & 0 deletions GetUserInput/GetUserInput.go
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,17 @@ func IfUsris2orMoreWords(SliceOfWords []string) bool {
return false
}
}

for Index := range features.MapUsage.SingleDef {
if result == Index && lastElement == "usage" {
color.HiCyan(fmt.Sprintln("============================================◉🔰🔰🔰🔰🔰🔰🔰◉=========================================="))
color.HiCyan(fmt.Sprintln(features.MapUsage.SingleDef[Index]))
color.HiCyan(fmt.Sprintln("============================================◉✅✅✅✅✅✅✅◉=========================================="))
return false
}
}


return true
}

Expand Down
6 changes: 5 additions & 1 deletion features/Every words in Golang.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@ var TitleOfAllIndexSlices = map[string]string{
"ALLHTTPCLIENTS": "ALLHTTPCLIENTS",
"ALL CREATING HTTP CLIENTS": "ALL CREATING HTTP CLIENTS",
"ALLCREATINGHTTPCLIENTS": "ALLCREATINGHTTPCLIENTS",
"ALL WORKING WITH DATABASES": "ALL WORKING WITH DATABASES",
"ALLWORKINGWITHDATABASES": "ALLWORKINGWITHDATABASES",
"ALL DATABASES": "ALL DATABASES",
"ALLDATABASES": "ALLDATABASES",
}

var OriginalFeatures Features = Features{
Expand Down Expand Up @@ -12023,7 +12027,7 @@ Output:
won't be added to the form until after the request will be sent, producing a form that not all servers will process.
It is important to call the Close method before sending the request.
████████████████████████████████████████████████████████████████████████
464.
464.Working with Databases
████████████████████████████████████████████████████████████████████████
465.
████████████████████████████████████████████████████████████████████████
Expand Down
61 changes: 61 additions & 0 deletions features/MapUsages.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
package features

type AllMapUsages struct {
SingleDef map[string]string
}

var MapUsage = AllMapUsages{
SingleDef: map[string]string{
"godoc":`Usage:
godoc [flag]
The flags are:
-v
verbose mode
-timestamps=true
show timestamps with directory listings
-index
enable identifier and full text search index
(no search box is shown if -index is not set)
-index_files=""
glob pattern specifying index files; if not empty,
the index is read from these files in sorted order
-index_throttle=0.75
index throttle value; a value of 0 means no time is allocated
to the indexer (the indexer will never finish), a value of 1.0
means that index creation is running at full throttle (other
goroutines may get no time while the index is built)
-index_interval=0
interval of indexing; a value of 0 sets it to 5 minutes, a
negative value indexes only once at startup
-play=false
enable playground
-links=true
link identifiers to their declarations
-write_index=false
write index to a file; the file name must be specified with
-index_files
-maxresults=10000
maximum number of full text search results shown
(no full text index is built if maxresults <= 0)
-notes="BUG"
regular expression matching note markers to show
(e.g., "BUG|TODO", ".*")
-goroot=$GOROOT
Go root directory
-http=addr
HTTP service address (e.g., '127.0.0.1:6060' or just ':6060')
-templates=""
directory containing alternate template files; if set,
the directory may provide alternative template files
for the files in $GOROOT/lib/godoc
-url=path
print to standard output the data that would be served by
an HTTP request for path
-zip=""
zip file providing the file system to serve; disabled if empty
`,
},
}
4 changes: 4 additions & 0 deletions features/SingleDefinitions.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ var OriginSingleDef = SingleDefinitions{

SingleDef: map[string]string{
"go": "Fans of Go (called gophers) describe Go as having the expressiveness of dynamic languages like Python or Ruby, with the performance of compiled languages like C or C++. The language is open source, and was started by engineers at Google. It's written using a C-style syntax, has statically typed variables, manages memory using garbage collection, and is compiled into stand-alone executables. Go is noted for the concurrent programming features built into the language core, the networking packages in the standard library (such as a web server), fast compilation and execution speed. Its simple, minimalistic and consistent language design make for a delightful experience, while the abundant and thoughtful tooling addresses traditional problems such as consistent formatting and documentation. The home page for Go is go.dev, and there is an excellent interactive tutorial at tour.go.dev.",
"godoc": "Godoc is a Go package that lets you create, manage, and use Go documentation in “the Go way”. for installing: sudo apt install golang-golang-x-tools. The Go way is a set of principles that, as a Go programmer, you should follow to improve code quality. Using Godoc, you can easily read other developers' documentation and code. You can also automate the creation of your own documentation and publish it using Godoc.Godoc is similar to Javadoc, the code documentor for Java. They both use comments and code in modules to generate documentation. And both tools structure that documentation in HTML so you can view it in a browser.",
"what is godoc?": "Godoc is a Go package that lets you create, manage, and use Go documentation in “the Go way”. for installing: sudo apt install golang-golang-x-tools. The Go way is a set of principles that, as a Go programmer, you should follow to improve code quality. Using Godoc, you can easily read other developers' documentation and code. You can also automate the creation of your own documentation and publish it using Godoc.Godoc is similar to Javadoc, the code documentor for Java. They both use comments and code in modules to generate documentation. And both tools structure that documentation in HTML so you can view it in a browser.",
"install godoc": "Run this in Terminal ===> sudo apt install golang-golang-x-tools",
"getting started with godoc": "install the Godoc package from the golang website using this command: go get golang.org/x/tools/cmd/godoc. Conventionally, Go developers use port 6060 to host documentation. This is the command for running a Godoc server on that port: godoc -http=:6060 . The command above hosts your code documentation on localhost, or 127.0.0.1. The port doesn't have to 6060; godoc will run on any unoccupied port. However, it's always best to follow the Go documentation conventions.",
"about go": "Fans of Go (called gophers) describe Go as having the expressiveness of dynamic languages like Python or Ruby, with the performance of compiled languages like C or C++. The language is open source, and was started by engineers at Google. It's written using a C-style syntax, has statically typed variables, manages memory using garbage collection, and is compiled into stand-alone executables. Go is noted for the concurrent programming features built into the language core, the networking packages in the standard library (such as a web server), fast compilation and execution speed. Its simple, minimalistic and consistent language design make for a delightful experience, while the abundant and thoughtful tooling addresses traditional problems such as consistent formatting and documentation. The home page for Go is go.dev, and there is an excellent interactive tutorial at tour.go.dev.",
"create environment go": "0.Create Environment GO in Command Line Interface Go: 1- go mod init YOURNAME 2- go work init YOURWORKDIRECTORY 3- go run main.go OR go run projectName.go",
"create go project": "0.Create Environment GO in Command Line Interface Go: 1- go mod init YOURNAME 2- go work init YOURWORKDIRECTORY 3- go run main.go OR go run projectName.go",
Expand Down
5 changes: 5 additions & 0 deletions features/SingleDefinitionsExamples.go
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,11 @@ value := float32(2.0) * x // invalid operation: mismatched types float32 and int
// you must convert int type to float32 before performing arithmetic operation
value := float32(2.0) * float32(x)`,

"godoc":`An Example Program With Godoc Comments
The code below adheres to the Go way, in this case using single-line comments.
===================================
`,

},

Expand Down
1 change: 1 addition & 0 deletions features/WorkingwithDatabases.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,6 @@ var TitleDataBases = []string{

var OriginalDataBases = DataBase{
Alldatafield: `
464.Working with Databases
`,
}
6 changes: 3 additions & 3 deletions mergeToMain.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
echo -n "Git push on branch develop "
echo ""
git add .
git commit -m " Add a feature for Question/Answer from user "
git commit -m " Add a feature if user wrote 'godoc usage' specified "
git push -u origin develop
echo "====================================================================="
echo -n "git checkout beforeMergeToMain "
Expand All @@ -16,7 +16,7 @@ echo "====================================================================="
echo -n "Git is Push for beforeMergeToMain "
echo ""
git add .
git commit -m " Add a feature for Question/Answer from user "
git commit -m " Add a feature if user wrote 'godoc usage' specified "
git push -u origin beforeMergeToMain
echo "====================================================================="
echo -n "git checkout main "
Expand All @@ -34,7 +34,7 @@ echo "====================================================================="
echo -n "Git is Push for main "
echo ""
git add .
git commit -m " Add a feature for Question/Answer from user "
git commit -m " Add a feature if user wrote 'godoc usage' specified "
git push -u origin main
echo "====================================================================="
echo -n "git checkout develop "
Expand Down

0 comments on commit 8f77d73

Please sign in to comment.