Add the support for multiple formats.
Some people does not use the common YYYYMMDDXX format and/or does not want to use the "; serial" comment right after the serial number. This commit allow multiple formats to be defined, hense more users can use the plugin. A huge consequence of this is that user can also define additional custom formats depending on their needs.
This commit is contained in:
parent
acc6dd81e1
commit
317389ec31
3 changed files with 133 additions and 21 deletions
|
@ -12,4 +12,28 @@
|
|||
" See the License for the specific language governing permissions and
|
||||
" limitations under the License.
|
||||
|
||||
|
||||
if !exists('g:dnsserial_custom_patterns')
|
||||
let g:dnsserial_custom_patterns = []
|
||||
endif
|
||||
|
||||
if !exists('g:dnsserial_patterns')
|
||||
let g:dnsserial_patterns = [
|
||||
\{
|
||||
\'regex': '\(\d\{8}\)\(\d\+\)\s*;\s*\cserial',
|
||||
\'matching': [
|
||||
\{'type': 'date', 'fmt': '%Y%m%d'},
|
||||
\{'type': 'integer', 'padding': 2, 'date_reset': 1}
|
||||
\]
|
||||
\},
|
||||
\{
|
||||
\'regex': '\(\d\+\)\s*;\s*\cserial',
|
||||
\'matching': [
|
||||
\{'type': 'integer'}
|
||||
\]
|
||||
\},
|
||||
\]
|
||||
endif
|
||||
|
||||
|
||||
command! DNSSerialUpdate call dnsserial#DNSSerialUpdate()
|
||||
|
|
Reference in a new issue