Skip to content
This repository was archived by the owner on Apr 29, 2018. It is now read-only.

Commit ba78d9e

Browse files
committed
README: add further API info
1 parent 3c03ce0 commit ba78d9e

File tree

1 file changed

+50
-0
lines changed

1 file changed

+50
-0
lines changed

README.md

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -260,6 +260,56 @@ with open(output, 'w') as csvfile:
260260
])
261261
```
262262

263+
The pretty print methods used above format the data in a more readable manner.
264+
We can compare the output from the `additional()` method and the
265+
`pprint_additional()` method.
266+
267+
The `additional()`, and `missing()`, methods return a list of lists that represent
268+
each block that contains a difference.
269+
270+
```python
271+
>>> from pprint import pprint
272+
>>> pprint(diff.additional())
273+
[['interface FastEthernet0/1', ' ip address 192.168.0.1 255.255.255.128'],
274+
['interface FastEthernet0/2',
275+
' ip address 192.168.0.2 255.255.255.0',
276+
' duplex auto',
277+
' speed auto'],
278+
['interface Vlan300',
279+
' description Corporate',
280+
' ip address 10.10.10.2 255.255.255.0',
281+
' no shutdown'],
282+
['ip route 0.0.0.0 0.0.0.0 192.168.0.2'],
283+
['line vty 0 4',
284+
' transport input telnet ssh',
285+
' transport output telnet ssh']]
286+
```
287+
288+
Whereas the `pprint_additional()` and `print_missing()` methods return strings
289+
that represent all the differences, with each block separated by a newline.
290+
291+
```python
292+
>>> print(diff.pprint_additional())
293+
interface FastEthernet0/1
294+
ip address 192.168.0.1 255.255.255.128
295+
296+
interface FastEthernet0/2
297+
ip address 192.168.0.2 255.255.255.0
298+
duplex auto
299+
speed auto
300+
301+
interface Vlan300
302+
description Corporate
303+
ip address 10.10.10.2 255.255.255.0
304+
no shutdown
305+
306+
ip route 0.0.0.0 0.0.0.0 192.168.0.2
307+
308+
line vty 0 4
309+
transport input telnet ssh
310+
transport output telnet ssh
311+
```
312+
263313
## Development setup
264314

265315
To run the test suite

0 commit comments

Comments
 (0)