image

the sleepy snake

index :: path :: compact_path

==== compact_path(path, w, measure=len, max_pardirs=2)====

Compacts a path to fit into a desired width path the path to compact

w the desired width (unsigned int)
measure the function to measure the width. Can be any method or funktion that takes a path as argument and returns an uint
max_pardirs maximum number of pardirs ("../") allowed in the compacted path

Returns the compacted path

myPath = "very/long/path/here"
print compact_path(myPath, 17)
>> "v../../path/here"