purpleidea / mgmt

Next generation distributed, event-driven, parallel config management!
https://purpleidea.com/tags/mgmtconfig/
GNU General Public License v3.0
3.58k stars 311 forks source link

New Function Ideas #641

Open S-ign opened 3 years ago

S-ign commented 3 years ago

Versions:

Description:

Random functions, let me know if any of these are useful

I already see a split and to_lower function in strings, so what about join and to_upper? while I'm at it most of the functions that are in go's strings module, or all of them?

I've also thought about a copy function that takes func Copy(text, sep string, copies int) returning either a string copied that many times or a slice of that string that many times, don't know if that useful but just throwing ideas out there.

Also what about some type of DNS, where you get func Dns(domainName string) and return a string of the IP? ex. input: "google.com" returns "172.217.165.46"

What about func IPRange(CIDRAddr string) returns network range? ex. input: "192.168.0.1/24" returns "192.168.0.1-192.168.0.254" or return a slice of strings ["192.168.0.1", 192.168.0.2" ...]

Those are some of my ideas so far, let me know which are most useful.