/tool fetch vs. :tool fetch and /ping vs. :ping

Hello experts,
as per title, could someone explain the difference and suggest when using / and when : ?
Thanks!

It’s style. Internally, they function the same (at the top level, that is).

To test that, /console/inspect allow scripting access to the stuff like CLI completion… so you can see both : and / result in the same number of options (and using / instead of : work same too).

:put [:len [/console/inspect request=completion input=":" as-value]]
85



/put [/len [:console/inspect request=completion input="/" as-value]]   
85

: = predefinited functions (like :pick :put etc.)
/ = subsection
fetch is a function, but inside the tool subsection

no a real differencies, but “tool” is a subsection, so is better to write :ping and /tool also for future changes and consistency.

Another example: global can be :global or /global without actual differencies, but is better keep same style for predefined functions than specify the path…

Thank you OP for asking this quesiton, and thank you @ammo and @rextended for the answers!

I hope it would not be considered hijacking the thread if I added a related question:

When would you use a slash (“/”) vs. a space (" ")?

For example:

/tool ping 1.1.1.1

vs.

/tool/ping 1.1.1.1

And: Can you please elaborate a little on “better keep same style for predefined functions than specify the path?”

Short: better use “/” just when you need to change actual path or call functions not directly on root.

Just some examples:
http://forum.mikrotik.com/t/rextended-fragments-of-snippets/151033/1


About spaces or /
Since 7.x it’s all than really done, and for other reasons,
better use space for thing shared with v6.
On things like wiregard etc. that are available only v7, not mind but better use “/” instead of space.

For me that I write script running on both, I prefer the space.

I think I've got it. For v7, are the following guidelines correct:

In the case of "ping" these are all identical:

: (colon) for Root Commands such as :ping

/ (slash) for Root Commands such as /ping

/ (slash) for full path Sub-Level Commands such as /tools/ping



But, the following does not work because they are not a Root Command nor are they the full path to the Command:

/health

:health

/arp/print

:arp/print



The following are identical:

:// such as :ip/arp/print

: such as :ip arp print

/// such as :ip/arp/print

/ such as /ip arp print