Minecraft wiki entry for enchant, associated text: To give the Infinity enchantment to all players holding a bow:
/enchant @a infinity
To enchant the nearest player's held sword with Sharpness 5:
/enchant @p sharpness 5