bug-recutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[bug-recutils] Field predefined types


From: OLLIER Jean-François
Subject: [bug-recutils] Field predefined types
Date: Tue, 1 Feb 2011 00:05:06 +0100
User-agent: Mutt/1.4.2.2i

Hi Jose,

I would like to expose an idea of mine; Its objective is to help lazy people as 
I to write repetitive descriptors.
We already have predefined field types, like "date" and "email", I suggest to 
allow the declaration of user-predefined
types.
  
An Example with 3 records definitions:
#----------------------------------------------------------------------------
%rec: Creation
%mandatory: Requestor Requestor_Email Request_Date
%type: Requestor regexp /^[A-Z][a-zA-Z-]+ [A-Z][a-zA-Z-]+$/
%type: Requestor_Email email
%type: Request_Date date

%rec: Deletion
%mandatory: Requestor Requestor_Email Request_Date
%type: Requestor regexp /^[A-Z][a-zA-Z-]+ [A-Z][a-zA-Z-]+$/
%type: Requestor_Email email
%type: Request_Date date

%rec: Account
%key: Login_Name
%mandatory: Firstname Lastname Approver
%type: Login_Name regexp /^[a-zA-Z][a-zA-Z0-9]{5}$/
%type: Firstname,Lastname regexp /^[A-Z][a-zA-Z-]+$/
%type: Approver regexp /^[A-Z][a-zA-Z-]+ [A-Z][a-zA-Z-]+$/
#----------------------------------------------------------------------------

These 3 records Use the same regexp for the fields Creation:Requestor,
Deletion:Requestor and Account:Approver

Assume we write the following declaration before the 3 records descriptors:

%define FullName regexp /^[A-Z][a-zA-Z-]+ [A-Z][a-zA-Z-]+$/

Then the records become easier to write and to read.

#----------------------------------------------------------------------------
%rec: Creation
%mandatory: Requestor Requestor_Email Request_Date
%type: Requestor FullName
%type: Requestor_Email email
%type: Request_Date date

%rec: Deletion
%mandatory: Requestor Requestor_Email Request_Date
%type: Requestor FullName
%type: Requestor_Email email
%type: Request_Date date

%rec: Account
%key: Login_Name
%mandatory: Firstname Lastname Approver
%type: Login_Name /^[a-zA-Z][a-zA-Z0-9]{5}$/
%type: Firstname,Lastname regexp /^[A-Z][a-zA-Z-]+$/
%type: Approver FullName
#----------------------------------------------------------------------------

Waiting for your comments,

-- 
Jean-François OLLIER
mailto:address@hidden



reply via email to

[Prev in Thread] Current Thread [Next in Thread]